ShellPkg : Check pointer before dereferencing

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@14144 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey 2013-02-22 18:20:55 +00:00
parent 9bdcf582d1
commit 7dd0562309
1 changed files with 10 additions and 8 deletions

View File

@ -146,14 +146,16 @@ CopySingleFile(
Size = 0;
StrnCatGrow(&TempName, &Size, Source, 0);
StrnCatGrow(&TempName, &Size, L"\\*", 0);
ShellOpenFileMetaArg((CHAR16*)TempName, EFI_FILE_MODE_READ, &List);
*TempName = CHAR_NULL;
StrnCatGrow(&TempName, &Size, Dest, 0);
StrnCatGrow(&TempName, &Size, L"\\", 0);
ShellStatus = ValidateAndCopyFiles(List, TempName, SilentMode, TRUE, Resp);
ShellCloseFileMetaArg(&List);
FreePool(TempName);
Size = 0;
if (TempName != NULL) {
ShellOpenFileMetaArg((CHAR16*)TempName, EFI_FILE_MODE_READ, &List);
*TempName = CHAR_NULL;
StrnCatGrow(&TempName, &Size, Dest, 0);
StrnCatGrow(&TempName, &Size, L"\\", 0);
ShellStatus = ValidateAndCopyFiles(List, TempName, SilentMode, TRUE, Resp);
ShellCloseFileMetaArg(&List);
SHELL_FREE_NON_NULL(TempName);
Size = 0;
}
} else {
//
// open file with create enabled