From 879dbe18d8d56ae4dd6ca70b832eccf135b9514d Mon Sep 17 00:00:00 2001 From: lzeng14 Date: Thu, 29 Nov 2012 01:19:20 +0000 Subject: Use mS3BootScriptTablePtr->TableLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE) to get the correct table length. Signed-off-by: Star Zeng Reviewed-by: Jiewen Yao git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13977 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'MdeModulePkg/Library') diff --git a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c index 5903b0f641..ee10655244 100644 --- a/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c +++ b/MdeModulePkg/Library/PiDxeS3BootScriptLib/BootScriptSave.c @@ -1989,13 +1989,10 @@ S3BootScriptCompare ( if (RelativePosition == NULL) { return EFI_INVALID_PARAMETER; } - TableLength = ((EFI_BOOT_SCRIPT_TABLE_HEADER*)Script)->TableLength; // - // If in boot time, TableLength does not include the termination node. so add it up + // mS3BootScriptTablePtr->TableLength does not include the termination node, so add it up // - if (!mS3BootScriptTablePtr->AtRuntime) { - TableLength += sizeof(EFI_BOOT_SCRIPT_TERMINATE); - } + TableLength = mS3BootScriptTablePtr->TableLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE); if (Position1 < Script || Position1 > Script+TableLength) { return EFI_INVALID_PARAMETER; } -- cgit v1.2.3