diff options
author | Tomas Mraz <tomas@openssl.org> | 2021-06-02 17:01:41 +0200 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2021-06-03 18:07:56 +0200 |
commit | 18d9c9bf96d54948790fd59068e8d46f6194439e (patch) | |
tree | 85984be62fed798570eeedcdd374201aeb882876 /apps | |
parent | 7d69c07ddf7a27bf4dca250c8a37b8f929d33100 (diff) |
openssl spkac: Fix reading SPKAC data from stdin
Fixes #15367
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15593)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/lib/apps.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/lib/apps.c b/apps/lib/apps.c index 3d6588ba23..8604c75251 100644 --- a/apps/lib/apps.c +++ b/apps/lib/apps.c @@ -404,14 +404,18 @@ CONF *app_load_config_verbose(const char *filename, int verbose) CONF *app_load_config_internal(const char *filename, int quiet) { - BIO *in = NULL; /* leads to empty config in case filename == "" */ + BIO *in; CONF *conf; - if (*filename != '\0' - && (in = bio_open_default_(filename, 'r', FORMAT_TEXT, quiet)) == NULL) - return NULL; - conf = app_load_config_bio(in, filename); - BIO_free(in); + if (filename == NULL || *filename != '\0') { + if ((in = bio_open_default_(filename, 'r', FORMAT_TEXT, quiet)) == NULL) + return NULL; + conf = app_load_config_bio(in, filename); + BIO_free(in); + } else { + /* Return empty config if filename is empty string. */ + conf = NCONF_new_ex(app_libctx, NULL); + } return conf; } |