Skip to content

Commit

Permalink
Bug 1649322 - Fix null pointer passed as argument in pk11wrap/pk11pbe…
Browse files Browse the repository at this point in the history
….c:1246 r=kjacobs

This is a fixup patch that reverts https://hg.mozilla.org/projects/nss/rev/cc43ebf5bf88355837c5fafa2f3c46e37626707a and adds a null check around the memcpy in question.

Differential Revision: https://phabricator.services.mozilla.com/D82494

--HG--
extra : moz-landing-system : lando
  • Loading branch information
beurdouche committed Jul 9, 2020
1 parent a412e70 commit 9351800
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/pk11wrap/pk11pbe.c
Expand Up @@ -1243,7 +1243,9 @@ PK11_CreatePBEParams(SECItem *salt, SECItem *pwd, unsigned int iterations)
if (!pbe_params->pPassword) {
goto loser;
}
PORT_Memcpy(pbe_params->pPassword, pwd->data, pwd->len);
if (pwd->data) {
PORT_Memcpy(pbe_params->pPassword, pwd->data, pwd->len);
}
pbe_params->ulPasswordLen = pwd->len;

pbe_params->pSalt = (CK_CHAR_PTR)PORT_ZAlloc(salt->len);
Expand Down
3 changes: 0 additions & 3 deletions lib/pkcs12/p12d.c
Expand Up @@ -1349,9 +1349,6 @@ sec_pkcs12_decoder_verify_mac(SEC_PKCS12DecoderContext *p12dcx)
iteration = 1;
}

if (!p12dcx->pwitem->data) {
goto loser;
}
params = PK11_CreatePBEParams(&p12dcx->macData.macSalt, p12dcx->pwitem,
iteration);

Expand Down

0 comments on commit 9351800

Please sign in to comment.