Bug 942818, data may be used uninitialized in nss_builtins_FindObjectsInit, r=ryan.sleevi NSS_3_15_4_BETA4
authorMaxim Philippov <philippovmi@gmail.com>
Mon, 25 Nov 2013 22:32:26 +0100
changeset 10943 5696596bdbc90d71fb12603a7c806973f55b0ca1
parent 10942 1cd59995c7e2bcaf9e65630f9a602c29795fcbad
child 10944 ba13c846f6ae59de0858fad7e6e597b0814b9e20
push id223
push userkaie@kuix.de
push dateMon, 25 Nov 2013 21:32:34 +0000
reviewersryan.sleevi
bugs942818
Bug 942818, data may be used uninitialized in nss_builtins_FindObjectsInit, r=ryan.sleevi
lib/ckfw/builtins/bfind.c
--- a/lib/ckfw/builtins/bfind.c
+++ b/lib/ckfw/builtins/bfind.c
@@ -110,21 +110,22 @@ builtins_attrmatch
 )
 {
   PRBool prb;
 
   if( a->ulValueLen != b->size ) {
     /* match a decoded serial number */
     if ((a->type == CKA_SERIAL_NUMBER) && (a->ulValueLen < b->size)) {
 	int len;
-	unsigned char *data;
+	unsigned char *data = NULL;
 
 	len = builtins_derUnwrapInt(b->data,b->size,&data);
-	if ((len == a->ulValueLen) && 
-		nsslibc_memequal(a->pValue, data, len, (PRStatus *)NULL)) {
+	if (data &&
+	    (len == a->ulValueLen) && 
+	    nsslibc_memequal(a->pValue, data, len, (PRStatus *)NULL)) {
 	    return CK_TRUE;
 	}
     }
     return CK_FALSE;
   }
 
   prb = nsslibc_memequal(a->pValue, b->data, b->size, (PRStatus *)NULL);