summaryrefslogtreecommitdiffstats
path: root/ShellPkg
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2017-05-23 09:47:26 +0800
committerHao Wu <hao.a.wu@intel.com>2017-05-24 13:17:51 +0800
commitd727614c913449a59e8333c4d75cff4ebf1f9779 (patch)
treef45a699d21e8ce4b4e077f9baa61e89e52989d5a /ShellPkg
parent2d499388452cf8215265a0757395e7dbcdb32ea8 (diff)
downloadedk2-d727614c913449a59e8333c4d75cff4ebf1f9779.tar.gz
edk2-d727614c913449a59e8333c4d75cff4ebf1f9779.tar.bz2
edk2-d727614c913449a59e8333c4d75cff4ebf1f9779.zip
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>
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiShellLib/UefiShellLib.c2
1 files changed, 1 insertions, 1 deletions
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 ^
//