X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ShellPkg%2FLibrary%2FUefiShellLevel2CommandsLib%2FLs.c;fp=ShellPkg%2FLibrary%2FUefiShellLevel2CommandsLib%2FLs.c;h=64ce4ae2c02b9e6a3130bfc8ad7681bb4e3d055a;hb=4f344fffc7fb541d11edf4cf657f84549b334244;hp=63af5eab18884d216110df720440073607260719;hpb=7292c69b2ae18cda8cd21f25daff85da1e69a23d;p=mirror_edk2.git diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c index 63af5eab18..64ce4ae2c0 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c @@ -437,7 +437,7 @@ PrintLsOutput( } } - if (!Sfo && HeaderPrinted == FALSE) { + if (!Sfo && !HeaderPrinted) { PrintNonSfoHeader(CorrectedPath); } PrintFileInformation(Sfo, Node, &FileCount, &FileSize, &DirCount); @@ -457,6 +457,9 @@ PrintLsOutput( ShellCloseFileMetaArg(&ListHead); CorrectedPath[0] = CHAR_NULL; 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); @@ -498,7 +501,7 @@ PrintLsOutput( SHELL_FREE_NON_NULL(CorrectedPath); ShellCloseFileMetaArg(&ListHead); - if (Found == NULL && FoundOne == FALSE) { + if (Found == NULL && !FoundOne) { return (SHELL_NOT_FOUND); }