mirror of https://github.com/acidanthera/audk.git
ShellPkg/Ls: Handle the case when SearchString is NULL
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
parent
fd4d9c6495
commit
795c78cf19
|
@ -709,6 +709,11 @@ ShellCommandRunLs (
|
|||
// must split off the search part that applies to files from the end of the directory part
|
||||
//
|
||||
StrnCatGrow(&SearchString, NULL, FullPath, 0);
|
||||
if (SearchString == NULL) {
|
||||
FreePool (FullPath);
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
return SHELL_OUT_OF_RESOURCES;
|
||||
}
|
||||
PathRemoveLastItem (FullPath);
|
||||
CopyMem (SearchString, SearchString + StrLen (FullPath), StrSize (SearchString + StrLen (FullPath)));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue