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)
This commit is contained in:
x2018 2021-11-23 21:33:17 +08:00 committed by Pauli
parent dc7e42c6a1
commit b9648f31a4
1 changed files with 2 additions and 0 deletions

View 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;