Browse Source

Coverity CID 1444952: Null pointer dereferences

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8888)
Pauli 5 years ago
parent
commit
ff6c7cc60f
1 changed files with 4 additions and 0 deletions
  1. 4 0
      crypto/evp/evp_enc.c

+ 4 - 0
crypto/evp/evp_enc.c

@@ -843,6 +843,10 @@ int EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl)
  legacy:
 
     *outl = 0;
+    if (ctx->cipher == NULL) {
+        EVPerr(EVP_F_EVP_DECRYPTFINAL_EX, EVP_R_NO_CIPHER_SET);
+        return 0;
+    }
 
     if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
         i = ctx->cipher->do_cipher(ctx, out, NULL, 0);