]> git.proxmox.com Git - mirror_edk2.git/blobdiff - CryptoPkg/Library/BaseCryptLib/Pk/CryptPkcs7Verify.c
CryptoPkg BaseCryptLib: Init the content of struct 'CertCtx' before use
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLib / Pk / CryptPkcs7Verify.c
index 242ba10bbf0e31f5946aee8673d792e4152ddcbd..efa3796af9fb3db0d5a15b016c605a121c993abc 100644 (file)
@@ -10,7 +10,7 @@
   WrapPkcs7Data(), Pkcs7GetSigners(), Pkcs7Verify() will get UEFI Authenticated\r
   Variable and will do basic check for data structure.\r
 \r
-Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2009 - 2016, 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
@@ -435,7 +435,7 @@ Pkcs7FreeSigners (
 \r
   @param[in]  P7Data            Pointer to the PKCS#7 message.\r
   @param[in]  P7Length          Length of the PKCS#7 message in bytes.\r
-  @param[out] SingerChainCerts  Pointer to the certificates list chained to signer's\r
+  @param[out] SignerChainCerts  Pointer to the certificates list chained to signer's\r
                                 certificate. It's caller's responsiblity to free the buffer.\r
   @param[out] ChainLength       Length of the chained certificates list buffer in bytes.\r
   @param[out] UnchainCerts      Pointer to the unchained certificates lists. It's caller's\r
@@ -489,6 +489,8 @@ Pkcs7GetCertificatesList (
   OldBuf         = NULL;\r
   Signers        = NULL;\r
 \r
+  ZeroMem (&CertCtx, sizeof (CertCtx));\r
+\r
   //\r
   // Parameter Checking\r
   //\r
@@ -521,7 +523,7 @@ Pkcs7GetCertificatesList (
   //\r
   // Obtains Signer's Certificate from PKCS#7 data\r
   // NOTE: Only one signer case will be handled in this function, which means SignerInfos\r
-  //       should include only one singer's certificate.\r
+  //       should include only one signer's certificate.\r
   //\r
   Signers = PKCS7_get0_signers (Pkcs7, NULL, PKCS7_BINARY);\r
   if ((Signers == NULL) || (sk_X509_num (Signers) != 1)) {\r
@@ -541,7 +543,7 @@ Pkcs7GetCertificatesList (
       goto _Error;\r
     }\r
   }\r
-  sk_X509_delete_ptr (CertCtx.untrusted, Signer);\r
+  (VOID)sk_X509_delete_ptr (CertCtx.untrusted, Signer);\r
 \r
   //\r
   // Build certificates stack chained from Signer's certificate.\r
@@ -571,7 +573,7 @@ Pkcs7GetCertificatesList (
         if (!sk_X509_push (CertCtx.chain, Issuer)) {\r
           goto _Error;\r
         }\r
-        sk_X509_delete_ptr (CertCtx.untrusted, Issuer);\r
+        (VOID)sk_X509_delete_ptr (CertCtx.untrusted, Issuer);\r
 \r
         Cert = Issuer;\r
         continue;\r