summaryrefslogtreecommitdiffstats
path: root/crypto/conf
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2023-06-26 11:11:57 +0200
committerTomas Mraz <tomas@openssl.org>2023-06-27 14:49:25 +0200
commit5c56cef501c5344a0e1c1061b356e74c24ca1cef (patch)
tree52485c32f0b42f7b0b0952a862acf644bc0bfc1a /crypto/conf
parent61892ab241b04bf4432d8432f216233877149ab8 (diff)
CONF_modules_load_file_ex(): Do not try to load an empty file name
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) (cherry picked from commit 8b7d5ea7dd602eb7c2c4bc5ad45489dc5fc711f6)
Diffstat (limited to 'crypto/conf')
-rw-r--r--crypto/conf/conf_mod.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c
index 17bbbf7a27..3f9685a12f 100644
--- a/crypto/conf/conf_mod.c
+++ b/crypto/conf/conf_mod.c
@@ -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;