From: Pauli Date: Wed, 3 Nov 2021 22:23:32 +0000 (+1000) Subject: avoid a NULL dereference when getting digest X-Git-Tag: openssl-3.2.0-alpha1~3387 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ab547fc005307ecf48451638e947cdabca147159;p=thirdparty%2Fopenssl.git avoid a NULL dereference when getting digest Fixes #16961 Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/16969) --- diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c index 64d7fb046de..24092cfd5be 100644 --- a/crypto/evp/evp_lib.c +++ b/crypto/evp/evp_lib.c @@ -999,7 +999,7 @@ EVP_MD *EVP_MD_CTX_get1_md(EVP_MD_CTX *ctx) if (ctx == NULL) return NULL; md = (EVP_MD *)ctx->reqdigest; - if (!EVP_MD_up_ref(md)) + if (md == NULL || !EVP_MD_up_ref(md)) return NULL; return md; }