diff options
author | Min M Xu <min.m.xu@intel.com> | 2022-11-27 15:00:14 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2022-12-02 01:06:01 +0000 |
commit | 47d988387efc8b45561f542f7a8e5b6a43979a8c (patch) | |
tree | 97cf7aa814750594d062347af182d7a0da73d882 /OvmfPkg/Library/PlatformInitLib | |
parent | a1d57239140f09a8b2cc386f9421f6f4e634435f (diff) | |
download | edk2-47d988387efc8b45561f542f7a8e5b6a43979a8c.zip edk2-47d988387efc8b45561f542f7a8e5b6a43979a8c.tar.gz edk2-47d988387efc8b45561f542f7a8e5b6a43979a8c.tar.bz2 |
OvmfPkg/PlatformInitLib: Add check to NvVarStoreFV HeaderLength
There should be a check that the FV HeaderLength cannot be an odd
number. Otherwise in the following CalculateSum16 there would be an
ASSERT.
In ValidateFvHeader@QemuFlashFvbServicesRuntimeDxe/FwBlockServices.c
there a is similar check to the FwVolHeader->HeaderLength.
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Diffstat (limited to 'OvmfPkg/Library/PlatformInitLib')
-rw-r--r-- | OvmfPkg/Library/PlatformInitLib/Platform.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/OvmfPkg/Library/PlatformInitLib/Platform.c b/OvmfPkg/Library/PlatformInitLib/Platform.c index 2582689..77f22de 100644 --- a/OvmfPkg/Library/PlatformInitLib/Platform.c +++ b/OvmfPkg/Library/PlatformInitLib/Platform.c @@ -653,6 +653,7 @@ PlatformValidateNvVarStore ( (!CompareGuid (&FvHdrGUID, &NvVarStoreFvHeader->FileSystemGuid)) ||
(NvVarStoreFvHeader->Signature != EFI_FVH_SIGNATURE) ||
(NvVarStoreFvHeader->Attributes != 0x4feff) ||
+ ((NvVarStoreFvHeader->HeaderLength & 0x01) != 0) ||
(NvVarStoreFvHeader->Revision != EFI_FVH_REVISION) ||
(NvVarStoreFvHeader->FvLength != NvVarStoreSize)
)
|