]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/VariableAuthenticated/Pei/Variable.c
SecurityPkg/VariableAuthenticated: Check if there is a NV Variable Storage header...
[mirror_edk2.git] / SecurityPkg / VariableAuthenticated / Pei / Variable.c
index 7549be2dca45ca02930b5bad5d02c9767652afc7..d27f679073827937fb6a57d763edd8903e0fc1d3 100644 (file)
@@ -359,6 +359,15 @@ GetVariableStore (
                                                            PcdGet64 (PcdFlashNvStorageVariableBase64) : \r
                                                            PcdGet32 (PcdFlashNvStorageVariableBase)\r
                                                           );\r
+\r
+        //\r
+        // Check if the Firmware Volume is not corrupted\r
+        //\r
+        if ((FvHeader->Signature != EFI_FVH_SIGNATURE) || (!CompareGuid (&gEfiSystemNvDataFvGuid, &FvHeader->FileSystemGuid))) {\r
+          DEBUG ((EFI_D_ERROR, "Firmware Volume for Variable Store is corrupted\n"));\r
+          break;\r
+        }\r
+        \r
         VariableStoreHeader = (VARIABLE_STORE_HEADER *) ((UINT8 *) FvHeader + FvHeader->HeaderLength);\r
 \r
         if (IndexTable != NULL) {\r