From: Tomas Mraz Date: Wed, 2 Jun 2021 15:01:41 +0000 (+0200) Subject: openssl spkac: Fix reading SPKAC data from stdin X-Git-Tag: openssl-3.0.0-beta1~217 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=18d9c9bf96d54948790fd59068e8d46f6194439e;p=thirdparty%2Fopenssl.git openssl spkac: Fix reading SPKAC data from stdin Fixes #15367 Reviewed-by: Matt Caswell Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/15593) --- diff --git a/apps/lib/apps.c b/apps/lib/apps.c index 3d6588ba23e..8604c752517 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; }