[Bug 336485] coverity thinks that nssPKIObject_GetInstances could return null which would lead to a crash [@ listCertsCallback]. r=nelson NSS_3_11_BRANCH
authoralexei.volkov.bugs%sun.com
Tue, 16 May 2006 23:47:45 +0000
branchNSS_3_11_BRANCH
changeset 7065 867d5f8eb11a31b71b6b5b0bb661ef24fc2f6245
parent 7063 f74e5022cf420f53df97ba9a3f7d5895e205a550
child 7068 d011ea6266271fd25e48604ad10b46b693d2f5dd
push idunknown
push userunknown
push dateunknown
reviewersnelson
bugs336485
[Bug 336485] coverity thinks that nssPKIObject_GetInstances could return null which would lead to a crash [@ listCertsCallback]. r=nelson
security/nss/lib/pk11wrap/pk11cert.c
--- a/security/nss/lib/pk11wrap/pk11cert.c
+++ b/security/nss/lib/pk11wrap/pk11cert.c
@@ -2384,16 +2384,19 @@ listCertsCallback(CERTCertificate* cert,
 {
     ListCertsArg *cdata = (ListCertsArg*)arg;
     char *nickname = NULL;
     nssCryptokiObject *instance, **ci;
     nssCryptokiObject **instances;
     NSSCertificate *c = STAN_GetNSSCertificate(cert);
 
     instances = nssPKIObject_GetInstances(&c->object);
+    if (!instances) {
+        return SECFailure;
+    }
     instance = NULL;
     for (ci = instances; *ci; ci++) {
 	if ((*ci)->token->pk11slot == cdata->slot) {
 	    instance = *ci;
 	    break;
 	}
     }
     PORT_Assert(instance != NULL);