From: Shane Lontis Date: Tue, 11 Aug 2020 07:01:07 +0000 (+1000) Subject: Fix coverity CID #1455335 - Dereference after NULL check in fromdata_init() X-Git-Tag: openssl-3.0.0-alpha7~499 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10ead93897ab48233d66cc40bfdc146d6c95c4a7;p=thirdparty%2Fopenssl.git Fix coverity CID #1455335 - Dereference after NULL check in fromdata_init() Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/12628) --- diff --git a/crypto/evp/pmeth_gn.c b/crypto/evp/pmeth_gn.c index 2f9346d9988..30968286789 100644 --- a/crypto/evp/pmeth_gn.c +++ b/crypto/evp/pmeth_gn.c @@ -375,7 +375,8 @@ static int fromdata_init(EVP_PKEY_CTX *ctx, int operation) return 1; not_supported: - ctx->operation = EVP_PKEY_OP_UNDEFINED; + if (ctx != NULL) + ctx->operation = EVP_PKEY_OP_UNDEFINED; ERR_raise(ERR_LIB_EVP, EVP_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE); return -2; }