diff options
author | Hao Wu <hao.a.wu@intel.com> | 2017-05-23 09:47:26 +0800 |
---|---|---|
committer | Guo Mang <mang.guo@intel.com> | 2017-07-12 11:24:53 +0800 |
commit | b527ce3be7b615d64339e6736a92a560b80f87d0 (patch) | |
tree | 0cc4379f1428d42b2a586eb5af4d7f74276d3bc7 | |
parent | 4134492635d78454857bca32ce16efb7aa846840 (diff) | |
download | edk2-platforms-b527ce3be7b615d64339e6736a92a560b80f87d0.tar.xz |
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)
-rw-r--r-- | Core/ShellPkg/Library/UefiShellLib/UefiShellLib.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Core/ShellPkg/Library/UefiShellLib/UefiShellLib.c b/Core/ShellPkg/Library/UefiShellLib/UefiShellLib.c index 0f37886956..c3a67c3be7 100644 --- a/Core/ShellPkg/Library/UefiShellLib/UefiShellLib.c +++ b/Core/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 ^
//
|