diff --git a/apps/ocsp.c b/apps/ocsp.c index 4769880fc6..56b76dba21 100644 --- a/apps/ocsp.c +++ b/apps/ocsp.c @@ -1091,6 +1091,12 @@ static void make_ocsp_response(BIO *err, OCSP_RESPONSE **resp, OCSP_REQUEST *req for (jj = 0; jj < sk_X509_num(ca) && !found; jj++) { X509 *ca_cert = sk_X509_value(ca, jj); OCSP_CERTID *ca_id = OCSP_cert_to_id(cert_id_md, NULL, ca_cert); + + if (ca_id == NULL) { + *resp = OCSP_response_create(OCSP_RESPONSE_STATUS_INTERNALERROR, + NULL); + goto end; + } if (OCSP_id_issuer_cmp(ca_id, cid) == 0) { found = 1;