check the return value of OPENSSL_strdup(CRYPTO_strdup) to prevent potential memory...
authorx2018 <xkernel.wang@foxmail.com>
Tue, 23 Nov 2021 13:33:17 +0000 (21:33 +0800)
committerPauli <ppzgs1@gmail.com>
Thu, 25 Nov 2021 02:03:40 +0000 (12:03 +1000)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17113)

(cherry picked from commit b9648f31a4917b8594caebda3e6d8d313514fe24)

apps/lib/app_rand.c

index e38d3a72fc7752e608ba213415683a800f27144e..08550d7bfc674f32a9bd6b8be6919c49ba316246 100644 (file)
@@ -110,6 +110,8 @@ int opt_rand(int opt)
     case OPT_R_WRITERAND:
         OPENSSL_free(save_rand_file);
         save_rand_file = OPENSSL_strdup(opt_arg());
+        if (save_rand_file == NULL)
+            return 0;
         break;
     }
     return 1;