Reviewed-by: Jaben Carsey <[email protected]>

> -----Original Message-----
> From: Wu, Hao A
> Sent: Monday, May 22, 2017 7:04 PM
> To: [email protected]
> Cc: Wu, Hao A <[email protected]>; Ni, Ruiyu <[email protected]>;
> Carsey, Jaben <[email protected]>
> 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 <[email protected]>
> Cc: Jaben Carsey <[email protected]>
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Hao Wu <[email protected]>
> ---
>  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

_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to