public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Pete Batard <pete@akeo.ie>, devel@edk2.groups.io
Cc: ard.biesheuvel@linaro.org, leif.lindholm@linaro.org
Subject: Re: [edk2-platforms][PATCH 1/1] Platform/RPi: Prevent buffer over-read when the command line is empty
Date: Mon, 4 Nov 2019 17:27:08 +0100	[thread overview]
Message-ID: <6a212357-4938-8950-4681-08523910c60f@redhat.com> (raw)
In-Reply-To: <20191104160617.11036-1-pete@akeo.ie>

On 11/4/19 5:06 PM, Pete Batard wrote:
> From: Andrei Warkentin <andrey.warkentin@gmail.com>
> 
> It is possible for the command line to be empty
> (Cmd->TagHead.TagValueSize = 0), in which case the code should not
> attempt to read the value at CommandLine[-1].

Oops...

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

> Signed-off-by: Pete Batard <pete@akeo.ie>
> ---
>   Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
> index 5a9d4c3f1787..9b4aa068857c 100644
> --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
> +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c
> @@ -927,7 +927,8 @@ RpiFirmwareGetCommmandLine (
>   
>     CopyMem (CommandLine, Cmd->CommandLine, Cmd->TagHead.TagValueSize);
>   
> -  if (CommandLine[Cmd->TagHead.TagValueSize - 1] != '\0') {
> +  if (Cmd->TagHead.TagValueSize == 0 ||
> +      CommandLine[Cmd->TagHead.TagValueSize - 1] != '\0') {
>       //
>       // Add a NUL terminator if required.
>       //
> 


  reply	other threads:[~2019-11-04 16:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-04 16:06 [edk2-platforms][PATCH 1/1] Platform/RPi: Prevent buffer over-read when the command line is empty Pete Batard
2019-11-04 16:27 ` Philippe Mathieu-Daudé [this message]
2019-11-07 16:21 ` Leif Lindholm
2019-11-07 17:05   ` Pete Batard
2019-11-07 17:27     ` Leif Lindholm
2019-11-07 17:35       ` Pete Batard
2019-11-07 18:09         ` Leif Lindholm

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-list 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=6a212357-4938-8950-4681-08523910c60f@redhat.com \
    --to=devel@edk2.groups.io \
    /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