summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwchang0222%aol.com <devnull@localhost>2003-12-22 23:17:25 +0000
committerwchang0222%aol.com <devnull@localhost>2003-12-22 23:17:25 +0000
commit9e0256c72cb910856e11d50b95905c7b8328ae86 (patch)
treead78e464426765f89a91e985ea38e6e82184ddc6
parent748b1e44b573edca33d22d514ce1a101cc7e7e1e (diff)
downloadnss-hg-9e0256c72cb910856e11d50b95905c7b8328ae86.tar.gz
Don't invoke PKCS11 with an invalid handle. Bug 226285.
Tag: NSS_3_8_BRANCH
-rw-r--r--security/nss/lib/pk11wrap/pk11skey.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/security/nss/lib/pk11wrap/pk11skey.c b/security/nss/lib/pk11wrap/pk11skey.c
index 6d582f874..48bd4c12f 100644
--- a/security/nss/lib/pk11wrap/pk11skey.c
+++ b/security/nss/lib/pk11wrap/pk11skey.c
@@ -2332,6 +2332,12 @@ PK11_PubWrapSymKey(CK_MECHANISM_TYPE type, SECKEYPublicKey *pubKey,
mechanism.ulParameterLen = 0;
id = PK11_ImportPublicKey(slot,pubKey,PR_FALSE);
+ if (id == CK_INVALID_HANDLE) {
+ if (newKey) {
+ PK11_FreeSymKey(newKey);
+ }
+ return SECFailure; /* Error code has been set. */
+ }
session = pk11_GetNewSession(slot,&owner);
if (!owner || !(slot->isThreadSafe)) PK11_EnterSlotMonitor(slot);