The branch master has been updated
via 3e0441520b9a349dc50662919ea18f03dfc0d624 (commit)
from 01fde90eec721b64bc0e1c01cd94a9fd431adcc6 (commit)
- Log -----------------------------------------------------------------
commit 3e0441520b9a349dc50662919ea18f03dfc0d624
Author: x2018 <[email protected]>
Date: Wed Nov 24 11:26:09 2021 +0800
check the return value of OPENSSL_strdup(CRYPTO_strdup) in
apps/lib/app_rand.c:32
Reviewed-by: Richard Levitte <[email protected]>
Reviewed-by: Paul Dale <[email protected]>
(Merged from https://github.com/openssl/openssl/pull/17124)
-----------------------------------------------------------------------
Summary of changes:
apps/lib/app_rand.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/apps/lib/app_rand.c b/apps/lib/app_rand.c
index 1e10044acc..ad93858bfd 100644
--- a/apps/lib/app_rand.c
+++ b/apps/lib/app_rand.c
@@ -28,8 +28,14 @@ void app_RAND_load_conf(CONF *c, const char *section)
BIO_printf(bio_err, "Can't load %s into RNG\n", randfile);
ERR_print_errors(bio_err);
}
- if (save_rand_file == NULL)
+ if (save_rand_file == NULL) {
save_rand_file = OPENSSL_strdup(randfile);
+ /* If some internal memory errors have occurred */
+ if (save_rand_file == NULL) {
+ BIO_printf(bio_err, "Can't duplicate %s\n", randfile);
+ ERR_print_errors(bio_err);
+ }
+ }
}
static int loadfiles(char *name)