]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
CONF_modules_load_file_ex(): Do not try to load an empty file name
authorTomas Mraz <tomas@openssl.org>
Mon, 26 Jun 2023 09:11:57 +0000 (11:11 +0200)
committerTomas Mraz <tomas@openssl.org>
Tue, 27 Jun 2023 12:48:33 +0000 (14:48 +0200)
Fixes #21258

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/21282)

crypto/conf/conf_mod.c

index 148ce6b5243832a09f086e28931279e5b230b617..38a8d4412f11fddcf1937c9eaca4d11860c249da 100644 (file)
@@ -184,15 +184,21 @@ int CONF_modules_load_file_ex(OSSL_LIB_CTX *libctx, const char *filename,
     CONF *conf = NULL;
     int ret = 0, diagnostics = 0;
 
+    ERR_set_mark();
+
     if (filename == NULL) {
         file = CONF_get1_default_config_file();
         if (file == NULL)
             goto err;
+        if (*file == '\0') {
+            /* Do not try to load an empty file name but do not error out */
+            ret = 1;
+            goto err;
+        }
     } else {
         file = (char *)filename;
     }
 
-    ERR_set_mark();
     conf = NCONF_new_ex(libctx, NULL);
     if (conf == NULL)
         goto err;