]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
check the return value of OPENSSL_strdup(CRYPTO_strdup) in apps/lib/app_rand.c:32
authorx2018 <xkernel.wang@foxmail.com>
Wed, 24 Nov 2021 03:26:09 +0000 (11:26 +0800)
committerPauli <ppzgs1@gmail.com>
Thu, 25 Nov 2021 06:08:25 +0000 (16:08 +1000)
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)

apps/lib/app_rand.c

index 08550d7bfc674f32a9bd6b8be6919c49ba316246..713792ead40a3d486ec21ffc03df6761ac5e460c 100644 (file)
@@ -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)