]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
rehash.c: handle possible null pointer returned by OPENSSL_strdup
authorXZ-X <xu1415@purdue.edu>
Mon, 22 Jul 2024 05:38:00 +0000 (01:38 -0400)
committerTomas Mraz <tomas@openssl.org>
Mon, 9 Sep 2024 07:20:43 +0000 (09:20 +0200)
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/24980)

(cherry picked from commit a5cd06f7fff3b4484946812191097b5e080b7610)

apps/rehash.c

index 9862b9fba916a06c5ef2090ae4429448fe0f3b5a..ad0f864fa3e900d21ff9f1a26996d4ace390657f 100644 (file)
@@ -559,6 +559,11 @@ int rehash_main(int argc, char **argv)
     } else if ((env = getenv(X509_get_default_cert_dir_env())) != NULL) {
         char lsc[2] = { LIST_SEPARATOR_CHAR, '\0' };
         m = OPENSSL_strdup(env);
+        if (m == NULL) {
+            BIO_puts(bio_err, "out of memory\n");
+            errs = 1;
+            goto end;
+        }
         for (e = strtok(m, lsc); e != NULL; e = strtok(NULL, lsc))
             errs += do_dir(e, h);
         OPENSSL_free(m);