From a7563b08d937bf6cf2c751b753b7743381c73c6c Mon Sep 17 00:00:00 2001 From: Shumin Qiu Date: Wed, 12 Feb 2014 01:51:15 +0000 Subject: 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 Reviewed-by: Jaben Carsey git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15230 6f19259b-4bc3-4df7-8a09-765794883524 --- ShellPkg/Application/Shell/ShellProtocol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ShellPkg') 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); } -- cgit v1.2.3