]> 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:07:53 +0000 (16:07 +1000)
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17124)

apps/lib/app_rand.c

index 1e10044accd20bb3ddfb49fc31a439cb0be7a72e..ad93858bfdbd7f76e8e7afa37e85a9103ef60d25 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)