mirror of https://github.com/acidanthera/audk.git
Add code to check whether the pointer 'CorrectedPath' and 'FullPath' are 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@15260 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
e27ecde731
commit
3a8406adb3
|
@ -379,6 +379,9 @@ PrintLsOutput(
|
|||
}
|
||||
|
||||
CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, RootPath, 0);
|
||||
if (CorrectedPath == NULL) {
|
||||
return SHELL_OUT_OF_RESOURCES;
|
||||
}
|
||||
if (CorrectedPath[StrLen(CorrectedPath)-1] != L'\\'
|
||||
&&CorrectedPath[StrLen(CorrectedPath)-1] != L'/') {
|
||||
CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, L"\\", 0);
|
||||
|
@ -666,8 +669,17 @@ ShellCommandRunLs (
|
|||
ASSERT((FullPath == NULL && Size == 0) || (FullPath != NULL));
|
||||
if (StrStr(PathName, L":") == NULL) {
|
||||
StrnCatGrow(&FullPath, &Size, gEfiShellProtocol->GetCurDir(NULL), 0);
|
||||
if (FullPath == NULL) {
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return SHELL_OUT_OF_RESOURCES;
|
||||
}
|
||||
}
|
||||
StrnCatGrow(&FullPath, &Size, PathName, 0);
|
||||
if (FullPath == NULL) {
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return SHELL_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
if (ShellIsDirectory(PathName) == EFI_SUCCESS) {
|
||||
//
|
||||
// is listing ends with a directory, then we list all files in that directory
|
||||
|
|
Loading…
Reference in New Issue