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 a2f1260a90af15a4bfebc5a04f85e4058bddbc62..1eb894b87fb74ca42fc37b32878d84efa4f2516e 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);