PROV: Avoid NULL dereference in SHA3 dup call.
authorPauli <paul.dale@oracle.com>
Wed, 20 Nov 2019 22:41:42 +0000 (08:41 +1000)
committerPauli <paul.dale@oracle.com>
Fri, 22 Nov 2019 05:20:54 +0000 (15:20 +1000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10487)

providers/implementations/digests/sha3_prov.c

index 251039e9920fe5645d643046a6fd6bab4ac55c24..44471959a723f50f0ba9709e5d09bf7cc4b8595f 100644 (file)
@@ -241,7 +241,8 @@ static void *keccak_dupctx(void *ctx)
     KECCAK1600_CTX *in = (KECCAK1600_CTX *)ctx;
     KECCAK1600_CTX *ret = OPENSSL_malloc(sizeof(*ret));
 
-    *ret = *in;
+    if (ret != NULL)
+        *ret = *in;
     return ret;
 }