From 0cae94a7e1bf640e8f30f69d98ab49b9aadb4fcc Mon Sep 17 00:00:00 2001 From: "alexei.volkov.bugs%sun.com" Date: Wed, 17 May 2006 20:52:16 +0000 Subject: [PATCH] [Bug 337011] OOM crash [@ sftk_handleKeyObject][@ sftk_handleKeyParameterObject] Dereferencing possibly NULL "attribute". r=nelson --- security/nss/lib/softoken/pkcs11.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/security/nss/lib/softoken/pkcs11.c b/security/nss/lib/softoken/pkcs11.c index 39ef7de027b..b06cb77f710 100644 --- a/security/nss/lib/softoken/pkcs11.c +++ b/security/nss/lib/softoken/pkcs11.c @@ -1649,6 +1649,9 @@ sftk_handleKeyObject(SFTKSession *session, SFTKObject *object) /* get the key type */ attribute = sftk_FindAttribute(object,CKA_KEY_TYPE); + if (!attribute) { + return CKR_ATTRIBUTE_VALUE_INVALID; + } key_type = *(CK_KEY_TYPE *)attribute->attrib.pValue; sftk_FreeAttribute(attribute); @@ -1755,6 +1758,9 @@ sftk_handleKeyParameterObject(SFTKSession *session, SFTKObject *object) /* get the key type */ attribute = sftk_FindAttribute(object,CKA_KEY_TYPE); + if (!attribute) { + return CKR_ATTRIBUTE_VALUE_INVALID; + } key_type = *(CK_KEY_TYPE *)attribute->attrib.pValue; sftk_FreeAttribute(attribute);