diff options
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c')
-rw-r--r-- | ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c | 42 |
1 files changed, 29 insertions, 13 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c index c03967e..acfd26c 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c @@ -42,6 +42,9 @@ PrintSfoVolumeInfoTableEntry ( if (Node->Handle == NULL) {
DirectoryName = GetFullyQualifiedPath (((EFI_SHELL_FILE_INFO *)GetFirstNode (&TheList->Link))->FullName);
+ if (DirectoryName == NULL) {
+ return (EFI_OUT_OF_RESOURCES);
+ }
//
// We need to open something up to get system information
@@ -70,12 +73,17 @@ PrintSfoVolumeInfoTableEntry ( if (Status == EFI_BUFFER_TOO_SMALL) {
SysInfo = AllocateZeroPool (SysInfoSize);
- Status = EfiFpHandle->GetInfo (
- EfiFpHandle,
- &gEfiFileSystemInfoGuid,
- &SysInfoSize,
- SysInfo
- );
+ if (SysInfo == NULL) {
+ gEfiShellProtocol->CloseFile (ShellFileHandle);
+ return (EFI_OUT_OF_RESOURCES);
+ }
+
+ Status = EfiFpHandle->GetInfo (
+ EfiFpHandle,
+ &gEfiFileSystemInfoGuid,
+ &SysInfoSize,
+ SysInfo
+ );
}
ASSERT_EFI_ERROR (Status);
@@ -97,12 +105,16 @@ PrintSfoVolumeInfoTableEntry ( if (Status == EFI_BUFFER_TOO_SMALL) {
SysInfo = AllocateZeroPool (SysInfoSize);
- Status = EfiFpHandle->GetInfo (
- EfiFpHandle,
- &gEfiFileSystemInfoGuid,
- &SysInfoSize,
- SysInfo
- );
+ if (SysInfo == NULL) {
+ return (EFI_OUT_OF_RESOURCES);
+ }
+
+ Status = EfiFpHandle->GetInfo (
+ EfiFpHandle,
+ &gEfiFileSystemInfoGuid,
+ &SysInfoSize,
+ SysInfo
+ );
}
ASSERT_EFI_ERROR (Status);
@@ -616,7 +628,11 @@ PrintLsOutput ( }
CorrectedPath = StrnCatGrow (&CorrectedPath, &LongestPath, L"*", 0);
- Status = ShellOpenFileMetaArg ((CHAR16 *)CorrectedPath, EFI_FILE_MODE_READ, &ListHead);
+ if (CorrectedPath == NULL) {
+ return SHELL_OUT_OF_RESOURCES;
+ }
+
+ Status = ShellOpenFileMetaArg ((CHAR16 *)CorrectedPath, EFI_FILE_MODE_READ, &ListHead);
if (!EFI_ERROR (Status)) {
for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode (&ListHead->Link)
|