From: Pauli Date: Mon, 29 Mar 2021 02:28:10 +0000 (+1000) Subject: x509: fix coverity 1474471: NULL pointer dereference X-Git-Tag: openssl-3.0.0-alpha14~93 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=03915534851daef6232c514cf1a8ea3158a7704e;p=thirdparty%2Fopenssl.git x509: fix coverity 1474471: NULL pointer dereference Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/14716) --- diff --git a/crypto/x509/x_all.c b/crypto/x509/x_all.c index c5e0c0b1ecb..042425456c6 100644 --- a/crypto/x509/x_all.c +++ b/crypto/x509/x_all.c @@ -434,8 +434,11 @@ ASN1_OCTET_STRING *X509_digest_sig(const X509 *cert) int X509_CRL_digest(const X509_CRL *data, const EVP_MD *type, unsigned char *md, unsigned int *len) { - if (type != NULL - && EVP_MD_is_a(type, SN_sha1) + if (type == NULL) { + ERR_raise(ERR_LIB_X509, ERR_R_PASSED_NULL_PARAMETER); + return 0; + } + if (EVP_MD_is_a(type, SN_sha1) && (data->flags & EXFLAG_SET) != 0 && (data->flags & EXFLAG_NO_FINGERPRINT) == 0) { /* Asking for SHA1; always computed in CRL d2i. */