From 57ad9d43b16aada77eaf6f6e1aaa0dd94f032bf2 Mon Sep 17 00:00:00 2001 From: ydong10 Date: Thu, 29 Sep 2011 01:10:20 +0000 Subject: [PATCH] Add more check to avoid access violation. Signed-off-by: ydong10 Reviewed-by: lgao4 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12470 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.c | 2 +- .../Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.c b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.c index 2f8b384f6f..482d6ad404 100644 --- a/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.c +++ b/EdkCompatibilityPkg/Compatibility/FrameworkHiiOnUefiHiiThunk/UefiIfrDefault.c @@ -358,7 +358,7 @@ UefiIfrGetBufferTypeDefaults ( ASSERT (UefiDefaults != NULL); *UefiDefaults = AllocateZeroPool (sizeof (LIST_ENTRY)); - ASSERT (UefiDefaults != NULL); + ASSERT (*UefiDefaults != NULL); InitializeListHead (*UefiDefaults); DefaultLink = GetFirstNode (&ThunkContext->FormSet->DefaultStoreListHead); diff --git a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c index 400b367136..c0ce1b23f8 100644 --- a/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c +++ b/EdkCompatibilityPkg/Foundation/Library/Dxe/EfiIfrSupportLib/IfrCommon.c @@ -582,7 +582,7 @@ Returns: // // Return an error if buffer is too small // - if (SizeOfNvStore > *ImageLength) { + if (SizeOfNvStore > *ImageLength || DefaultImage == NULL) { gBS->FreePool (OldData); *ImageLength = (UINT16) SizeOfNvStore; return EFI_BUFFER_TOO_SMALL; -- 2.39.2