From: Pauli Date: Sun, 26 Apr 2020 22:25:33 +0000 (+1000) Subject: coverity 1462545 Dereference after null check X-Git-Tag: openssl-3.0.0-alpha2~128 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=dc8908bfe29c50e98655c8c75be4be84da4d46f6;p=oweals%2Fopenssl.git coverity 1462545 Dereference after null check Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/11651) --- diff --git a/crypto/evp/p_lib.c b/crypto/evp/p_lib.c index 84fb91412f..053c9cb557 100644 --- a/crypto/evp/p_lib.c +++ b/crypto/evp/p_lib.c @@ -230,9 +230,11 @@ static int evp_pkey_cmp_any(const EVP_PKEY *a, const EVP_PKEY *b, * us to compare types using legacy NIDs. */ if ((a->type != EVP_PKEY_NONE - && !EVP_KEYMGMT_is_a(b->keymgmt, OBJ_nid2sn(a->type))) + && (b->keymgmt == NULL + || !EVP_KEYMGMT_is_a(b->keymgmt, OBJ_nid2sn(a->type)))) || (b->type != EVP_PKEY_NONE - && !EVP_KEYMGMT_is_a(a->keymgmt, OBJ_nid2sn(b->type)))) + && (a->keymgmt == NULL + || !EVP_KEYMGMT_is_a(a->keymgmt, OBJ_nid2sn(b->type))))) return -1; /* not the same key type */ /*