From b473622698a24ea8a5bb143ebad1959d19a64774 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ketelaars?= Date: Tue, 14 Jul 2020 06:57:43 +0200 Subject: [PATCH] Always initialize config_t structure, fixes #270 Without this change the config_t structure is ONLY initialized when it meets a specific criterion. If this criterion is not met the config_t structure is still used, which can cause a segmentation fault. Fixes #270. --- sslh-conf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sslh-conf.c b/sslh-conf.c index 355f160..cf30519 100644 --- a/sslh-conf.c +++ b/sslh-conf.c @@ -1432,7 +1432,6 @@ static int read_compounds(config_setting_t* cfg, static int c2s_parse_file(const char* filename, config_t* c, char**errmsg) { /* Read config file */ - config_init(c); if (config_read_file(c, filename) == CONFIG_FALSE) { if (config_error_line(c) != 0) { asprintf(errmsg, "%s:%d:%s", @@ -1488,7 +1487,7 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg) return 0; } - + config_init(&c); if (sslhcfg_conffile->count) { if (!c2s_parse_file(sslhcfg_conffile->filename[0], &c, &errmsg)) { fprintf(stderr, "%s\n", errmsg);