public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Matt Fleming <matt@codeblueprint.co.uk>
To: "Luck, Tony" <tony.luck@intel.com>
Cc: Insu Yun <wuninsu@gmail.com>,
	"linux-efi@vger.kernel.org" <linux-efi@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"taesoo@gatech.edu" <taesoo@gatech.edu>,
	"yeongjin.jang@gatech.edu" <yeongjin.jang@gatech.edu>,
	"insu@gatech.edu" <insu@gatech.edu>,
	"changwoo@gatech.edu" <changwoo@gatech.edu>
Subject: Re: [PATCH] efi: fix out-of-bounds null overwrite vulnerability
Date: Mon, 11 Jan 2016 14:16:05 +0000	[thread overview]
Message-ID: <20160111141605.GC2644@codeblueprint.co.uk> (raw)
In-Reply-To: <3908561D78D1C84285E8C5FCA982C28F39FA7208@ORSMSX114.amr.corp.intel.com>

On Fri, 08 Jan, at 04:47:17PM, Luck, Tony wrote:
> > 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.
> 
>         if (bank && device)
>                 n = snprintf(msg, len, "DIMM location: %s %s ", bank, device);
> 
> That looks like "snprintf", not "scnprintf" to me :-)
 
Oops! Can you believe I looked at the wrong function?

> What about using:
> 
> 	msg[len] = '\0';
> 
> to guarantee NUL termination?

But that may leave garbage bytes in 'rcd_decode_str' in the case where
the string isn't as long as 'len'.

How about memset()'ing the buffer to zero and deleting the NUL
termination line?

  reply	other threads:[~2016-01-11 14:16 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
2016-01-08 16:47   ` Luck, Tony
2016-01-11 14:16     ` Matt Fleming [this message]
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=20160111141605.GC2644@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