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
This commit is contained in:
Shumin Qiu 2014-02-12 01:51:15 +00:00 committed by shenshushi
parent 892eccc8d8
commit a7563b08d9
1 changed files with 3 additions and 1 deletions

View File

@ -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);
}