Bug 1649322 - Fix null pointer passed as argument in pk11wrap/pk11pbe.c:1246 r=kjacobs
authorBenjamin Beurdouche <bbeurdouche@mozilla.com>
Tue, 30 Jun 2020 14:51:24 +0000
changeset 15686 cc43ebf5bf88355837c5fafa2f3c46e37626707a
parent 15685 eebfbf29be2ffebd6623c08c36c3173a4c696f53
child 15687 b579895aceb0d36fc586e9031d8c5d7a4111201a
push id3784
push userkjacobs@mozilla.com
push dateTue, 30 Jun 2020 14:52:05 +0000
reviewerskjacobs
bugs1649322
Bug 1649322 - Fix null pointer passed as argument in pk11wrap/pk11pbe.c:1246 r=kjacobs Differential Revision: https://phabricator.services.mozilla.com/D81668
lib/pkcs12/p12d.c
--- a/lib/pkcs12/p12d.c
+++ b/lib/pkcs12/p12d.c
@@ -1344,16 +1344,19 @@ sec_pkcs12_decoder_verify_mac(SEC_PKCS12
 
     /* generate hmac key */
     if (p12dcx->macData.iter.data) {
         iteration = (int)DER_GetInteger(&p12dcx->macData.iter);
     } else {
         iteration = 1;
     }
 
+    if (!p12dcx->pwitem->data) {
+        goto loser;
+    }
     params = PK11_CreatePBEParams(&p12dcx->macData.macSalt, p12dcx->pwitem,
                                   iteration);
 
     algtag = SECOID_GetAlgorithmTag(&p12dcx->macData.safeMac.digestAlgorithm);
     switch (algtag) {
         case SEC_OID_SHA1:
             integrityMech = CKM_NSS_PBE_SHA1_HMAC_KEY_GEN;
             break;