mirror of https://github.com/acidanthera/audk.git
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:
parent
705b0c031f
commit
57ad9d43b1
|
@ -358,7 +358,7 @@ UefiIfrGetBufferTypeDefaults (
|
||||||
ASSERT (UefiDefaults != NULL);
|
ASSERT (UefiDefaults != NULL);
|
||||||
|
|
||||||
*UefiDefaults = AllocateZeroPool (sizeof (LIST_ENTRY));
|
*UefiDefaults = AllocateZeroPool (sizeof (LIST_ENTRY));
|
||||||
ASSERT (UefiDefaults != NULL);
|
ASSERT (*UefiDefaults != NULL);
|
||||||
InitializeListHead (*UefiDefaults);
|
InitializeListHead (*UefiDefaults);
|
||||||
|
|
||||||
DefaultLink = GetFirstNode (&ThunkContext->FormSet->DefaultStoreListHead);
|
DefaultLink = GetFirstNode (&ThunkContext->FormSet->DefaultStoreListHead);
|
||||||
|
|
|
@ -582,7 +582,7 @@ Returns:
|
||||||
//
|
//
|
||||||
// Return an error if buffer is too small
|
// Return an error if buffer is too small
|
||||||
//
|
//
|
||||||
if (SizeOfNvStore > *ImageLength) {
|
if (SizeOfNvStore > *ImageLength || DefaultImage == NULL) {
|
||||||
gBS->FreePool (OldData);
|
gBS->FreePool (OldData);
|
||||||
*ImageLength = (UINT16) SizeOfNvStore;
|
*ImageLength = (UINT16) SizeOfNvStore;
|
||||||
return EFI_BUFFER_TOO_SMALL;
|
return EFI_BUFFER_TOO_SMALL;
|
||||||
|
|
Loading…
Reference in New Issue