From: "Carsey, Jaben" <jaben.carsey@intel.com>
To: "Wu, Hao A" <hao.a.wu@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Ni, Ruiyu" <ruiyu.ni@intel.com>
Subject: Re: [PATCH] ShellPkg/UefiShellLib: Avoid reading undefined content before string
Date: Tue, 23 May 2017 15:51:05 +0000 [thread overview]
Message-ID: <CB6E33457884FA40993F35157061515C630C593A@FMSMSX103.amr.corp.intel.com> (raw)
In-Reply-To: <20170523020410.9184-1-hao.a.wu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
> -----Original Message-----
> From: Wu, Hao A
> Sent: Monday, May 22, 2017 7:04 PM
> To: edk2-devel@lists.01.org
> Cc: Wu, Hao A <hao.a.wu@intel.com>; Ni, Ruiyu <ruiyu.ni@intel.com>;
> Carsey, Jaben <jaben.carsey@intel.com>
> Subject: [PATCH] ShellPkg/UefiShellLib: Avoid reading undefined content
> before string
> Importance: High
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=566
>
> In function InternalShellPrintWorker(), if the string in variable
> 'mPostReplaceFormat2' starts with character L'%', the following
> expression:
>
> *(ResumeLocation-1) == L'^' at line 2831
>
> will read an undefined value before the starting of string
> 'mPostReplaceFormat2'.
>
> This commit adds additional logic to avoid reading undefined content.
>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jaben Carsey <jaben.carsey@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Hao Wu <hao.a.wu@intel.com>
> ---
> ShellPkg/Library/UefiShellLib/UefiShellLib.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> index 55e8a67ac4..25706e9bc3 100644
> --- a/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> +++ b/ShellPkg/Library/UefiShellLib/UefiShellLib.c
> @@ -2828,7 +2828,7 @@ InternalShellPrintWorker(
> // update the attribute
> //
> if (ResumeLocation != NULL) {
> - if (*(ResumeLocation-1) == L'^') {
> + if ((ResumeLocation != mPostReplaceFormat2) && (*(ResumeLocation-
> 1) == L'^')) {
> //
> // Move cursor back 1 position to overwrite the ^
> //
> --
> 2.12.0.windows.1
prev parent reply other threads:[~2017-05-23 15:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-23 2:04 [PATCH] ShellPkg/UefiShellLib: Avoid reading undefined content before string Hao Wu
2017-05-23 15:51 ` Carsey, Jaben [this message]
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=CB6E33457884FA40993F35157061515C630C593A@FMSMSX103.amr.corp.intel.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