ShellPkg/UefiShellLib: Avoid reading undefined content before string
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.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
(cherry picked from commit d727614c91
)
This commit is contained in:
@ -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 ^
|
||||
//
|
||||
|
Reference in New Issue
Block a user