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
This commit is contained in:
ydong10 2011-09-29 01:10:20 +00:00
parent 705b0c031f
commit 57ad9d43b1
2 changed files with 2 additions and 2 deletions

View File

@ -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);

View File

@ -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;