From 22aee63f498deddf46f5ca5c1756456232719892 Mon Sep 17 00:00:00 2001 From: "wchang0222%aol.com" Date: Mon, 22 Dec 2003 23:20:10 +0000 Subject: Don't invoke PKCS11 with an invalid handle. Bug 226285. Tag: NSS_3_4_BRANCH --- security/nss/lib/pk11wrap/pk11skey.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); -- cgit v1.2.1