]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
openssl: get_cert_chain: fix NULL dereference
authorDaniel Stenberg <daniel@haxx.se>
Tue, 17 May 2016 07:34:33 +0000 (09:34 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 17 May 2016 07:34:33 +0000 (09:34 +0200)
CID 1361815: Explicit null dereferenced (FORWARD_NULL)

lib/vtls/openssl.c

index 93373e03d2f2c209c8a2809a2f9ef6d3c30f1088..fea0dfe4fde4c1bc0b8a30a0baf558b516914ea8 100644 (file)
@@ -2550,9 +2550,11 @@ static CURLcode get_cert_chain(struct connectdata *conn,
       EVP_PKEY_free(pubkey);
     }
 
-    for(j = 0; j < psig->length; j++)
-      BIO_printf(mem, "%02x:", psig->data[j]);
-    push_certinfo("Signature", i);
+    if(psig) {
+      for(j = 0; j < psig->length; j++)
+        BIO_printf(mem, "%02x:", psig->data[j]);
+      push_certinfo("Signature", i);
+    }
 
     PEM_write_bio_X509(mem, x);
     push_certinfo("Cert", i);