summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjulien.pierre.bugs%sun.com <devnull@localhost>2004-10-23 20:46:49 +0000
committerjulien.pierre.bugs%sun.com <devnull@localhost>2004-10-23 20:46:49 +0000
commitf19e7530fea767e340f0fe0391a80c4c404cb155 (patch)
tree60a2ace1414385e5dfe877ddc43f7efa77ae9856
parent206122eb84fefe94722ae2d929e1fb4406df953a (diff)
downloadnss-hg-f19e7530fea767e340f0fe0391a80c4c404cb155.tar.gz
Workaround for bug 262192 . check attribute ptr in pk11_forceTokenAttribute, and object in pk11_forceAttribute .
-rw-r--r--security/nss/lib/softoken/pkcs11u.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/security/nss/lib/softoken/pkcs11u.c b/security/nss/lib/softoken/pkcs11u.c
index cfa2ca631..ce935172e 100644
--- a/security/nss/lib/softoken/pkcs11u.c
+++ b/security/nss/lib/softoken/pkcs11u.c
@@ -1704,6 +1704,11 @@ pk11_forceTokenAttribute(PK11Object *object,CK_ATTRIBUTE_TYPE type,
* allow it to happen. Let label setting go through so
* we have the opportunity to repair any database corruption. */
attribute=pk11_FindAttribute(object,type);
+ PORT_Assert(attribute);
+ if (!attribute) {
+ return CKR_ATTRIBUTE_TYPE_INVALID;
+
+ }
if ((type != CKA_LABEL) && (attribute->attrib.ulValueLen == len) &&
PORT_Memcmp(attribute->attrib.pValue,value,len) == 0) {
pk11_FreeAttribute(attribute);
@@ -1742,6 +1747,14 @@ pk11_forceAttribute(PK11Object *object,CK_ATTRIBUTE_TYPE type, void *value,
PRBool freeData = PR_FALSE;
if (pk11_isToken(object->handle)) {
+ PORT_Assert(object);
+ PORT_Assert(object->refCount);
+ PORT_Assert(object->slot);
+ if (!object ||
+ !object->refCount ||
+ !object->slot) {
+ return CKR_DEVICE_ERROR;
+ }
return pk11_forceTokenAttribute(object,type,value,len);
}
attribute=pk11_FindAttribute(object,type);