summaryrefslogtreecommitdiffstats
path: root/crypto/evp
diff options
context:
space:
mode:
authorPauli <pauli@openssl.org>2021-11-04 08:23:32 +1000
committerDr. Matthias St. Pierre <matthias.st.pierre@ncp-e.com>2021-11-07 22:07:36 +0100
commit0cb66d6bfeb7685f5776e1a93d716024fe678018 (patch)
tree5614fd978c60b7cb7efbe8f61035ea2e0ad28ad5 /crypto/evp
parent51f416d7c90e0eb04f9b0c5be189426e27f5779e (diff)
avoid a NULL dereference when getting digest
Fixes #16961 Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/16969) (cherry picked from commit ab547fc005307ecf48451638e947cdabca147159)
Diffstat (limited to 'crypto/evp')
-rw-r--r--crypto/evp/evp_lib.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/evp/evp_lib.c b/crypto/evp/evp_lib.c
index 64d7fb046d..24092cfd5b 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;
}