From 4894dcad6282985a96f5b3b560019c21c2bb3a6b Mon Sep 17 00:00:00 2001 From: Pauli Date: Tue, 7 May 2019 10:18:29 +1000 Subject: [PATCH] Coverity CID 1444963: Null pointer dereferences Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/8888) --- crypto/evp/evp_enc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c index d7ba7ddb85..a2f1260a90 100644 --- a/crypto/evp/evp_enc.c +++ b/crypto/evp/evp_enc.c @@ -620,7 +620,11 @@ int EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl) return 0; } - if (ctx->cipher == NULL || ctx->cipher->prov == NULL) + if (ctx->cipher == NULL) { + EVPerr(EVP_F_EVP_ENCRYPTFINAL_EX, EVP_R_NO_CIPHER_SET); + return 0; + } + if (ctx->cipher->prov == NULL) goto legacy; blocksize = EVP_CIPHER_CTX_block_size(ctx); -- 2.25.1