]> git.proxmox.com Git - mirror_edk2.git/blobdiff - SecurityPkg/VariableAuthenticated/EsalVariableDxeSal/AuthService.c
Refine code to make it more safely.
[mirror_edk2.git] / SecurityPkg / VariableAuthenticated / EsalVariableDxeSal / AuthService.c
index 38f462628ad71872772aafac8c6e23cd295e6758..45d5cfe3c655769d15ceef081e863f6d4d686185 100644 (file)
@@ -2,7 +2,7 @@
   Implement authentication services for the authenticated variable\r
   service in UEFI2.2.\r
 \r
   Implement authentication services for the authenticated variable\r
   service in UEFI2.2.\r
 \r
-Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials \r
 are licensed and made available under the terms and conditions of the BSD License \r
 which accompanies this distribution.  The full text of the license may be found at \r
 This program and the accompanying materials \r
 are licensed and made available under the terms and conditions of the BSD License \r
 which accompanies this distribution.  The full text of the license may be found at \r
@@ -48,6 +48,8 @@ AutenticatedVariableServiceInitialize (
   VARIABLE_HEADER         VariableHeader;\r
   BOOLEAN                 Valid;\r
 \r
   VARIABLE_HEADER         VariableHeader;\r
   BOOLEAN                 Valid;\r
 \r
+  ZeroMem (&VariableHeader, sizeof (VARIABLE_HEADER));\r
+\r
   mVariableModuleGlobal->AuthenticatedVariableGuid[Physical] = &gEfiAuthenticatedVariableGuid;\r
   mVariableModuleGlobal->CertRsa2048Sha256Guid[Physical]     = &gEfiCertRsa2048Sha256Guid;\r
   mVariableModuleGlobal->ImageSecurityDatabaseGuid[Physical] = &gEfiImageSecurityDatabaseGuid;\r
   mVariableModuleGlobal->AuthenticatedVariableGuid[Physical] = &gEfiAuthenticatedVariableGuid;\r
   mVariableModuleGlobal->CertRsa2048Sha256Guid[Physical]     = &gEfiCertRsa2048Sha256Guid;\r
   mVariableModuleGlobal->ImageSecurityDatabaseGuid[Physical] = &gEfiImageSecurityDatabaseGuid;\r
@@ -484,6 +486,7 @@ ProcessVarWithPk (
   BOOLEAN                     Valid;\r
 \r
   OldPkList = NULL;\r
   BOOLEAN                     Valid;\r
 \r
   OldPkList = NULL;\r
+  ZeroMem (&VariableHeader, sizeof (VARIABLE_HEADER));\r
 \r
   if ((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0) {\r
     //\r
 \r
   if ((Attributes & EFI_VARIABLE_NON_VOLATILE) == 0) {\r
     //\r
@@ -623,6 +626,7 @@ ProcessVarWithKek (
   BOOLEAN                         Valid;\r
 \r
   KekList = NULL;\r
   BOOLEAN                         Valid;\r
 \r
   KekList = NULL;\r
+  ZeroMem (&VariableHeader, sizeof (VARIABLE_HEADER));\r
 \r
   if (mPlatformMode == USER_MODE) {\r
     if ((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) == 0) {\r
 \r
   if (mPlatformMode == USER_MODE) {\r
     if ((Attributes & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) == 0) {\r