From: x2018 Date: Tue, 23 Nov 2021 13:33:17 +0000 (+0800) Subject: check the return value of OPENSSL_strdup(CRYPTO_strdup) to prevent potential memory... X-Git-Tag: openssl-3.0.1~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd0c0eb7a54aed1d0b8b71ad22253558dc26d646;p=thirdparty%2Fopenssl.git check the return value of OPENSSL_strdup(CRYPTO_strdup) to prevent potential memory access error Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/17113) (cherry picked from commit b9648f31a4917b8594caebda3e6d8d313514fe24) --- diff --git a/apps/lib/app_rand.c b/apps/lib/app_rand.c index e38d3a72fc7..08550d7bfc6 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;