From: Timo Sirainen Date: Mon, 4 Nov 2024 12:06:47 +0000 (+0200) Subject: config: config_get_value() - Fix crash if looking up setting that only has default... X-Git-Tag: 2.4.0~298 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ce8862bdd0ba83b7add37ea428ec12f149d47b31;p=thirdparty%2Fdovecot%2Fcore.git config: config_get_value() - Fix crash if looking up setting that only has default value --- diff --git a/src/config/config-parser.c b/src/config/config-parser.c index bef2a68bd2..587891df46 100644 --- a/src/config/config-parser.c +++ b/src/config/config-parser.c @@ -1880,19 +1880,18 @@ config_get_value(struct config_section_stack *section, def->type == SET_FILTER_NAME || def->type == SET_FILTER_ARRAY) return FALSE; - if (l->change_counters != NULL) { - if (l->change_counters[config_key->define_idx] != 0) { - str_append(str, l->settings[config_key->define_idx].str); - return TRUE; - } - if (!expand_parent || section->prev == NULL) { - /* use the default setting */ - const void *value = CONST_PTR_OFFSET(l->info->defaults, - def->offset); - if (!config_export_type(str, value, def->type)) - i_unreached(); - return TRUE; - } + if (l->change_counters != NULL && + l->change_counters[config_key->define_idx] != 0) { + str_append(str, l->settings[config_key->define_idx].str); + return TRUE; + } + if (!expand_parent || section->prev == NULL) { + /* use the default setting */ + const void *value = CONST_PTR_OFFSET(l->info->defaults, + def->offset); + if (!config_export_type(str, value, def->type)) + i_unreached(); + return TRUE; } /* not changed by this parser. maybe parent has. */