summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorx2018 <xkernel.wang@foxmail.com>2021-11-23 21:33:17 +0800
committerPauli <ppzgs1@gmail.com>2021-11-25 12:03:11 +1000
commitb9648f31a4917b8594caebda3e6d8d313514fe24 (patch)
tree3b1d47aac1fabe02d8f2453dd11f265aec8bc149 /apps
parentdc7e42c6a12637bae1660561d3f4cef039001475 (diff)
check the return value of OPENSSL_strdup(CRYPTO_strdup) to prevent potential memory access error
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17113)
Diffstat (limited to 'apps')
-rw-r--r--apps/lib/app_rand.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/apps/lib/app_rand.c b/apps/lib/app_rand.c
index d3181e56fa..1e10044acc 100644
--- a/apps/lib/app_rand.c
+++ b/apps/lib/app_rand.c
@@ -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;