Coverity CID 1444958: Null pointer dereferences
authorPauli <paul.dale@oracle.com>
Tue, 7 May 2019 00:48:42 +0000 (10:48 +1000)
committerPauli <paul.dale@oracle.com>
Tue, 7 May 2019 23:52:58 +0000 (09:52 +1000)
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8888)

crypto/evp/evp_enc.c

index a2f1260..1eb894b 100644 (file)
@@ -699,7 +699,11 @@ int EVP_DecryptUpdate(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_DECRYPTUPDATE, EVP_R_NO_CIPHER_SET);
+        return 0;
+    }
+    if (ctx->cipher->prov == NULL)
         goto legacy;
 
     blocksize = EVP_CIPHER_CTX_block_size(ctx);