summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwchang0222%aol.com <devnull@localhost>2003-12-22 23:20:10 +0000
committerwchang0222%aol.com <devnull@localhost>2003-12-22 23:20:10 +0000
commit22aee63f498deddf46f5ca5c1756456232719892 (patch)
tree48d7508b3539b4fa601d03232e84cfc112cafc33
parent31f102bb3202b3ec83333582c619ec497eef31e1 (diff)
downloadnss-hg-NSS_3_4_BRANCH.tar.gz
Don't invoke PKCS11 with an invalid handle. Bug 226285.NSS_3_4_BRANCH
Tag: NSS_3_4_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 f2530f481..f4f7e9d47 100644
--- a/security/nss/lib/pk11wrap/pk11skey.c
+++ b/security/nss/lib/pk11wrap/pk11skey.c
@@ -2228,6 +2228,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);