summaryrefslogtreecommitdiff
path: root/edk2/SecurityPkg/VariableAuthenticated/Pei/Variable.c
diff options
context:
space:
mode:
Diffstat (limited to 'edk2/SecurityPkg/VariableAuthenticated/Pei/Variable.c')
-rw-r--r--edk2/SecurityPkg/VariableAuthenticated/Pei/Variable.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/edk2/SecurityPkg/VariableAuthenticated/Pei/Variable.c b/edk2/SecurityPkg/VariableAuthenticated/Pei/Variable.c
index 7549be2dc..d27f67907 100644
--- a/edk2/SecurityPkg/VariableAuthenticated/Pei/Variable.c
+++ b/edk2/SecurityPkg/VariableAuthenticated/Pei/Variable.c
@@ -359,6 +359,15 @@ GetVariableStore (
PcdGet64 (PcdFlashNvStorageVariableBase64) :
PcdGet32 (PcdFlashNvStorageVariableBase)
);
+
+ //
+ // Check if the Firmware Volume is not corrupted
+ //
+ if ((FvHeader->Signature != EFI_FVH_SIGNATURE) || (!CompareGuid (&gEfiSystemNvDataFvGuid, &FvHeader->FileSystemGuid))) {
+ DEBUG ((EFI_D_ERROR, "Firmware Volume for Variable Store is corrupted\n"));
+ break;
+ }
+
VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINT8 *) FvHeader + FvHeader->HeaderLength);
if (IndexTable != NULL) {