]> 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:37 +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 9a5be029d3fb9fbbe1d0f6c859aa933e3181183e..798004b79d439874527f608af7f5698d74393c6e 100644 (file)
@@ -562,6 +562,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);