]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
1.Add code to check the pointer 'CorrectedPath' in Ls.c line 460 before referenced...
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel2CommandsLib / Ls.c
index 63af5eab18884d216110df720440073607260719..64ce4ae2c02b9e6a3130bfc8ad7681bb4e3d055a 100644 (file)
@@ -437,7 +437,7 @@ PrintLsOutput(
         }\r
       }\r
 \r
-      if (!Sfo && HeaderPrinted == FALSE) {\r
+      if (!Sfo && !HeaderPrinted) {\r
         PrintNonSfoHeader(CorrectedPath);\r
       }\r
       PrintFileInformation(Sfo, Node, &FileCount, &FileSize, &DirCount);\r
@@ -457,6 +457,9 @@ PrintLsOutput(
     ShellCloseFileMetaArg(&ListHead);\r
     CorrectedPath[0] = CHAR_NULL;\r
     CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, RootPath, 0);\r
+    if (CorrectedPath == NULL) {\r
+      return SHELL_OUT_OF_RESOURCES;\r
+    }\r
     if (CorrectedPath[StrLen(CorrectedPath)-1] != L'\\'\r
       &&CorrectedPath[StrLen(CorrectedPath)-1] != L'/') {\r
       CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, L"\\",     0);\r
@@ -498,7 +501,7 @@ PrintLsOutput(
   SHELL_FREE_NON_NULL(CorrectedPath);\r
   ShellCloseFileMetaArg(&ListHead);\r
 \r
-  if (Found == NULL && FoundOne == FALSE) {\r
+  if (Found == NULL && !FoundOne) {\r
     return (SHELL_NOT_FOUND);\r
   }\r
 \r