summaryrefslogtreecommitdiffstats
path: root/apps/lib/app_rand.c
diff options
context:
space:
mode:
authorx2018 <xkernel.wang@foxmail.com>2021-11-24 11:26:09 +0800
committerPauli <ppzgs1@gmail.com>2021-11-25 16:08:25 +1000
commit1c981ebb6e3346ebd0e76d0100ad0e1e854dbdda (patch)
treeba92736911e27b719fdc05a723e602184a742f8c /apps/lib/app_rand.c
parent7f3211743ea15fd86e6c138d96aec3bce7bd6b21 (diff)
check the return value of OPENSSL_strdup(CRYPTO_strdup) in apps/lib/app_rand.c:32
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17124) (cherry picked from commit 3e0441520b9a349dc50662919ea18f03dfc0d624)
Diffstat (limited to 'apps/lib/app_rand.c')
-rw-r--r--apps/lib/app_rand.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/apps/lib/app_rand.c b/apps/lib/app_rand.c
index 08550d7bfc..713792ead4 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)