From dc8908bfe29c50e98655c8c75be4be84da4d46f6 Mon Sep 17 00:00:00 2001 From: Pauli Date: Mon, 27 Apr 2020 08:25:33 +1000 Subject: [PATCH] coverity 1462545 Dereference after null check Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/11651) --- crypto/evp/p_lib.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 */ /* -- 2.34.1