openssl: get_cert_chain: fix NULL dereference

CID 1361815: Explicit null dereferenced (FORWARD_NULL)
This commit is contained in:
Daniel Stenberg 2016-05-17 09:34:33 +02:00
parent 8132fe11b3
commit 675c30abc2
1 changed files with 5 additions and 3 deletions

View 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);