summaryrefslogtreecommitdiff
path: root/ShellPkg/Application/Shell
diff options
context:
space:
mode:
authorShumin Qiu <shumin.qiu@intel.com>2014-02-12 01:51:15 +0000
committershenshushi <shenshushi@6f19259b-4bc3-4df7-8a09-765794883524>2014-02-12 01:51:15 +0000
commita7563b08d937bf6cf2c751b753b7743381c73c6c (patch)
treeddb69b6a47a1626870dbdeb90aad01a166e759ca /ShellPkg/Application/Shell
parent892eccc8d8697ada395b50738c099f8596a78d82 (diff)
downloadedk2-platforms-a7563b08d937bf6cf2c751b753b7743381c73c6c.tar.xz
Add code to check whether the pointer 'PathForReturn' in ShellProtocol.c is NULL before used.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Shumin Qiu <shumin.qiu@intel.com> Reviewed-by: Jaben Carsey <Jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15230 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Application/Shell')
-rw-r--r--ShellPkg/Application/Shell/ShellProtocol.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c
index 0a19793a1b..52904e9e02 100644
--- a/ShellPkg/Application/Shell/ShellProtocol.c
+++ b/ShellPkg/Application/Shell/ShellProtocol.c
@@ -467,7 +467,9 @@ EfiShellGetFilePathFromDevicePath(
// If necessary, add a "\", but otherwise don't
// (This is specified in the above section, and also implied by the
// UEFI Shell spec section 3.7)
- if ((PathForReturn[PathSize - 1] != L'\\') &&
+ if ((PathSize != 0) &&
+ (PathForReturn != NULL) &&
+ (PathForReturn[PathSize - 1] != L'\\') &&
(AlignedNode->PathName[0] != L'\\')) {
PathForReturn = StrnCatGrow (&PathForReturn, &PathSize, L"\\", 1);
}