Use mS3BootScriptTablePtr->TableLength + sizeof (EFI_BOOT_SCRIPT_TERMINATE) to get the correct table length.

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13977 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lzeng14 2012-11-29 01:19:20 +00:00
parent f3ac87a7f5
commit 879dbe18d8
1 changed files with 2 additions and 5 deletions

View File

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