summaryrefslogtreecommitdiffstats
path: root/ShellPkg
diff options
context:
space:
mode:
authorHao Wu <hao.a.wu@intel.com>2017-05-23 09:47:26 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2017-06-02 15:58:27 +0800
commit3e47c01c851af1bb033579ef2c10729f1dd04eef (patch)
tree9c3a3a605679552743af84202cb27784c3d3c427 /ShellPkg
parentfc2ef2115f8151aa2b94806f1c646f851a0dada7 (diff)
downloadedk2-3e47c01c851af1bb033579ef2c10729f1dd04eef.tar.gz
edk2-3e47c01c851af1bb033579ef2c10729f1dd04eef.tar.bz2
edk2-3e47c01c851af1bb033579ef2c10729f1dd04eef.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> (cherry picked from commit d727614c913449a59e8333c4d75cff4ebf1f9779)
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 0f37886956..c3a67c3be7 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 ^
//