]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/VariableAuthenticated/RuntimeDxe/Variable.c
Check the input VaraibleName for db/dbx when appending variables with formatted as...
[mirror_edk2.git] / SecurityPkg / VariableAuthenticated / RuntimeDxe / Variable.c
index 123ce6f8f0fddcab98c22dce45622b9a941014e7..ce4f6e813ef833b800ac3223b8f6459cd6746bd0 100644 (file)
@@ -808,6 +808,7 @@ Reclaim (
     //\r
     // Reinstall the new public key database.\r
     //\r
+    ASSERT (PubKeyHeader != NULL);\r
     CopyMem (CurrPtr, (UINT8*) PubKeyHeader, sizeof (VARIABLE_HEADER));\r
     Variable = (VARIABLE_HEADER*) CurrPtr;\r
     Variable->DataSize = NewPubKeySize;\r
@@ -1819,11 +1820,11 @@ UpdateVariable (
         DataOffset = sizeof (VARIABLE_HEADER) + Variable->CurrPtr->NameSize + GET_PAD_SIZE (Variable->CurrPtr->NameSize);\r
         CopyMem (mStorageArea, (UINT8*)((UINTN) Variable->CurrPtr + DataOffset), Variable->CurrPtr->DataSize);\r
 \r
-        if (CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) ||\r
-               (CompareGuid (VendorGuid, &gEfiGlobalVariableGuid) && (StrCmp (VariableName, EFI_KEY_EXCHANGE_KEY_NAME) == 0))) {\r
+        if ((CompareGuid (VendorGuid, &gEfiImageSecurityDatabaseGuid) &&\r
+            ((StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE) == 0) || (StrCmp (VariableName, EFI_IMAGE_SECURITY_DATABASE1) == 0))) ||\r
+            (CompareGuid (VendorGuid, &gEfiGlobalVariableGuid) && (StrCmp (VariableName, EFI_KEY_EXCHANGE_KEY_NAME) == 0))) {\r
           //\r
-          // For variables with the GUID EFI_IMAGE_SECURITY_DATABASE_GUID (i.e. where the data\r
-          // buffer is formatted as EFI_SIGNATURE_LIST), the driver shall not perform an append of\r
+          // For variables with formatted as EFI_SIGNATURE_LIST, the driver shall not perform an append of\r
           // EFI_SIGNATURE_DATA values that are already part of the existing variable value.\r
           //\r
           BufSize = AppendSignatureList (mStorageArea, Variable->CurrPtr->DataSize, Data, DataSize);\r