From 2349cf6f63fc450c455f902c8a424f2d8930d266 Mon Sep 17 00:00:00 2001 From: ydong10 Date: Thu, 9 Dec 2010 08:25:59 +0000 Subject: Refine code to make code run more safely. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11143 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c | 4 ++++ .../Foundation/Library/RuntimeDxe/EfiRuntimeLib/X64/RuntimeLib.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'EdkCompatibilityPkg/Foundation') diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c index 43d7fc6364..b0c9a7f1f2 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/UefiEfiIfrSupportLib/UefiIfrForm.c @@ -1395,6 +1395,10 @@ Returns: return EFI_BUFFER_TOO_SMALL; } + if (ConfigHdr == NULL) { + return EFI_INVALID_PARAMETER; + } + *StrBufferLen = BufferSize; StrPtr = ConfigHdr; diff --git a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/X64/RuntimeLib.c b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/X64/RuntimeLib.c index 11b36e056d..a81bd0fb0f 100644 --- a/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/X64/RuntimeLib.c +++ b/EdkCompatibilityPkg/Foundation/Library/RuntimeDxe/EfiRuntimeLib/X64/RuntimeLib.c @@ -930,7 +930,7 @@ Returns: // Try to get the PEI version of ReportStatusCode. // Status = GetPeiProtocol (&gEfiStatusCodeRuntimeProtocolGuid, (VOID **) &gReportStatusCode); - if (EFI_ERROR (Status)) { + if (EFI_ERROR (Status) || (gReportStatusCode == NULL)) { return EFI_UNSUPPORTED; } } -- cgit v1.2.3