From: lzeng14 Date: Tue, 27 Nov 2012 11:20:01 +0000 (+0000) Subject: Add the memory check to reserve memory for TERMINATE opcode in S3BootScriptGetBootTim... X-Git-Tag: edk2-stable201903~12869 X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=commitdiff_plain;h=d03b313050ddeb4146e514e30178b50cfe91dd9c Add the memory check to reserve memory for TERMINATE opcode in S3BootScriptGetBootTimeEntryAddAddress. Signed-off-by: Star Zeng Reviewed-by: Jiewen Yao git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13965 6f19259b-4bc3-4df7-8a09-765794883524 --- diff --git a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c index 32c7a55ac2..5903b0f641 100644 --- a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c +++ b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c @@ -542,7 +542,7 @@ S3BootScriptGetBootTimeEntryAddAddress ( // Here we do not count the reserved memory for runtime script table. PageNumber = (UINT16)(mS3BootScriptTablePtr->TableMemoryPageNumber - PcdGet16(PcdS3BootScriptRuntimeTableReservePageNumber)); TableLength = mS3BootScriptTablePtr->TableLength; - if ((UINT32)(PageNumber * EFI_PAGE_SIZE) < (TableLength + EntryLength)) { + if ((UINT32)(PageNumber * EFI_PAGE_SIZE) < (TableLength + EntryLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE))) { // // The buffer is too small to hold the table, Reallocate the buffer //