Bug 1465186 - null earlier in sftkdb_decodeCipherText, r=mt
authorFranziskus Kiefer <franziskuskiefer@gmail.com>
Wed, 06 Jun 2018 10:28:17 +0200
changeset 14398 26bfb61fde636ad3caeaee7708b9818a4423805d
parent 14397 9391fc982e713f66db0007f86f24abb74d9b51d3
child 14399 db7f6facd8dfa0ec4f91612b62c563ecf3892063
push id3121
push userfranziskuskiefer@gmail.com
push dateFri, 08 Jun 2018 12:51:03 +0000
reviewersmt
bugs1465186
Bug 1465186 - null earlier in sftkdb_decodeCipherText, r=mt Differential Revision: https://phabricator.services.mozilla.com/D1554
lib/softoken/sftkpwd.c
--- a/lib/softoken/sftkpwd.c
+++ b/lib/softoken/sftkpwd.c
@@ -133,22 +133,24 @@ const SEC_ASN1Template sftkdb_EncryptedD
  */
 static SECStatus
 sftkdb_decodeCipherText(SECItem *cipherText, sftkCipherValue *cipherValue)
 {
     PLArenaPool *arena = NULL;
     SFTKDBEncryptedDataInfo edi;
     SECStatus rv;
 
+    PORT_Assert(cipherValue);
+    cipherValue->arena = NULL;
+    cipherValue->param = NULL;
+
     arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
     if (arena == NULL) {
         return SECFailure;
     }
-    cipherValue->arena = NULL;
-    cipherValue->param = NULL;
 
     rv = SEC_QuickDERDecodeItem(arena, &edi, sftkdb_EncryptedDataInfoTemplate,
                                 cipherText);
     if (rv != SECSuccess) {
         goto loser;
     }
     cipherValue->alg = SECOID_GetAlgorithmTag(&edi.algorithm);
     cipherValue->param = nsspkcs5_AlgidToParam(&edi.algorithm);