public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matt Fleming <matt@codeblueprint.co.uk>
To: Insu Yun <wuninsu@gmail.com>
Cc: linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
	taesoo@gatech.edu, yeongjin.jang@gatech.edu, insu@gatech.edu,
	changwoo@gatech.edu, Tony Luck <tony.luck@intel.com>
Subject: Re: [PATCH] efi: fix out-of-bounds null overwrite vulnerability
Date: Fri, 8 Jan 2016 10:13:23 +0000	[thread overview]
Message-ID: <20160108101323.GA2532@codeblueprint.co.uk> (raw)
In-Reply-To: <1452193530-76672-1-git-send-email-wuninsu@gmail.com>

On Thu, 07 Jan, at 02:05:30PM, Insu Yun wrote:
> snprintf's return value is not bound by size value.
> (https://www.kernel.org/doc/htmldocs/kernel-api/API-snprintf.html)
> if printed value is larger than buffer size, it can overwrite 
> null byte in out-of-bounds buffer.
 
But this function doesn't use snprintf(), it uses scnprintf() which
returns the number of characters written into buf and, because
scnprintf() largely follows vnsprintf(), it will never write more than
'size' bytes into the buffer.

> Signed-off-by: Insu Yun <wuninsu@gmail.com>
> ---
>  drivers/firmware/efi/cper.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/firmware/efi/cper.c b/drivers/firmware/efi/cper.c
> index d425374..77aa75f 100644
> --- a/drivers/firmware/efi/cper.c
> +++ b/drivers/firmware/efi/cper.c
> @@ -267,7 +267,6 @@ static int cper_dimm_err_location(struct cper_mem_err_compact *mem, char *msg)
>  			     "DIMM location: not present. DMI handle: 0x%.4x ",
>  			     mem->mem_dev_handle);
>  
> -	msg[n] = '\0';
>  	return n;
>  }
>  

Calling this a vulnerability is a little extreme. These fields come
from firmware and if you can't trust the firmware you've got bigger
issues.

I'm not even sure this is a bug. Tony?

  reply	other threads:[~2016-01-08 10:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-07 19:05 [PATCH] efi: fix out-of-bounds null overwrite vulnerability Insu Yun
2016-01-08 10:13 ` Matt Fleming [this message]
2016-01-08 16:47   ` Luck, Tony
2016-01-11 14:16     ` Matt Fleming
2016-01-11 18:16       ` Luck, Tony
2016-01-14 11:12         ` Matt Fleming
2016-01-15  2:06           ` Tony Luck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160108101323.GA2532@codeblueprint.co.uk \
    --to=matt@codeblueprint.co.uk \
    --cc=changwoo@gatech.edu \
    --cc=insu@gatech.edu \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=taesoo@gatech.edu \
    --cc=tony.luck@intel.com \
    --cc=wuninsu@gmail.com \
    --cc=yeongjin.jang@gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox