ShellPkg: Add checking for memory allocation and pointer returns from functions.

signed-off-by: jcarsey
reviewed-by: lgrosenb

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12542 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jcarsey
2011-10-17 17:49:21 +00:00
parent 532691c8ba
commit c8c2259156
4 changed files with 16 additions and 9 deletions

View File

@ -2865,9 +2865,10 @@ ShellPrintHiiEx(
@param[in] DirName Path to directory to test.
@retval EFI_SUCCESS The Path represents a directory
@retval EFI_NOT_FOUND The Path does not represent a directory
@return other The path failed to open
@retval EFI_SUCCESS The Path represents a directory
@retval EFI_NOT_FOUND The Path does not represent a directory
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.
@return The path failed to open
**/
EFI_STATUS
EFIAPI
@ -2892,6 +2893,10 @@ ShellIsDirectory(
//
if (gEfiShellProtocol != NULL) {
TempLocation = StrnCatGrow(&TempLocation, NULL, DirName, 0);
if (TempLocation == NULL) {
ShellCloseFile(&Handle);
return (EFI_OUT_OF_RESOURCES);
}
TempLocation2 = StrStr(TempLocation, L":");
if (TempLocation2 != NULL && StrLen(StrStr(TempLocation, L":")) == 2) {
*(TempLocation2+1) = CHAR_NULL;