diff options
author | Martin Thomson <mt@lowentropy.net> | 2019-02-28 07:06:59 +1100 |
---|---|---|
committer | Martin Thomson <mt@lowentropy.net> | 2019-02-28 07:06:59 +1100 |
commit | b36763e466622576bf509098b5b48b9c1786c607 (patch) | |
tree | 8feec834f504632b174776954a4c1a46cffb706c | |
parent | 2ca67f190304b2c7905351d266e54f9a2ac178d6 (diff) | |
download | nss-hg-b36763e466622576bf509098b5b48b9c1786c607.tar.gz |
Bug 1531074 - SECKEY_SetPublicValue derefs after null checks, r=rrelyeaNSS_3_43_BETA1
Summary: This should help with our coverity analysis.
Reviewers: rrelyea
Tags: #secure-revision
Bug #: 1531074
Differential Revision: https://phabricator.services.mozilla.com/D21423
-rw-r--r-- | lib/pk11wrap/pk11akey.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/pk11wrap/pk11akey.c b/lib/pk11wrap/pk11akey.c index 97adabb50..c36f6ce71 100644 --- a/lib/pk11wrap/pk11akey.c +++ b/lib/pk11wrap/pk11akey.c @@ -1683,8 +1683,8 @@ SECKEY_SetPublicValue(SECKEYPrivateKey *privKey, SECItem *publicValue) SECStatus rv; SECKEYPublicKey pubKey; PLArenaPool *arena; - PK11SlotInfo *slot = privKey->pkcs11Slot; - CK_OBJECT_HANDLE privKeyID = privKey->pkcs11ID; + PK11SlotInfo *slot; + CK_OBJECT_HANDLE privKeyID; if (privKey == NULL || publicValue == NULL || publicValue->data == NULL || publicValue->len == 0) { @@ -1704,6 +1704,9 @@ SECKEY_SetPublicValue(SECKEYPrivateKey *privKey, SECItem *publicValue) if (arena == NULL) { return SECFailure; } + + slot = privKey->pkcs11Slot; + privKeyID = privKey->pkcs11ID; rv = SECFailure; switch (privKey->keyType) { default: |