From c8c2259156709f1995994dadbf469a8920649bc8 Mon Sep 17 00:00:00 2001 From: jcarsey Date: Mon, 17 Oct 2011 17:49:21 +0000 Subject: 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 --- ShellPkg/Application/Shell/ShellParametersProtocol.c | 2 +- ShellPkg/Application/Shell/ShellProtocol.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'ShellPkg/Application/Shell') diff --git a/ShellPkg/Application/Shell/ShellParametersProtocol.c b/ShellPkg/Application/Shell/ShellParametersProtocol.c index 55cf3c279e..91a0f5f8a2 100644 --- a/ShellPkg/Application/Shell/ShellParametersProtocol.c +++ b/ShellPkg/Application/Shell/ShellParametersProtocol.c @@ -1040,7 +1040,7 @@ UpdateStdInStdOutStdErr( TempHandle = CreateFileInterfaceFile(TempHandle, FALSE); } Size = 0; - if (((EFI_FILE_PROTOCOL*)TempHandle)->Read(TempHandle, &Size, NULL) != EFI_BUFFER_TOO_SMALL) { + if (TempHandle != NULL || ((EFI_FILE_PROTOCOL*)TempHandle)->Read(TempHandle, &Size, NULL) != EFI_BUFFER_TOO_SMALL) { Status = EFI_INVALID_PARAMETER; } else { ShellParameters->StdIn = TempHandle; diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index 6b81918101..00bbc358fa 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -2249,9 +2249,7 @@ EfiShellFindFiles( MapName = StrnCatGrow(&MapName, NULL, PatternCopy, Count); if (MapName == NULL) { Status = EFI_OUT_OF_RESOURCES; - } - - if (!EFI_ERROR(Status)) { + } else { RootDevicePath = EfiShellGetDevicePathFromFilePath(PatternCopy); if (RootDevicePath == NULL) { Status = EFI_INVALID_PARAMETER; -- cgit v1.2.3