]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
config: config_get_value() - Fix crash if looking up setting that only has default...
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 4 Nov 2024 12:06:47 +0000 (14:06 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Fri, 17 Jan 2025 08:40:00 +0000 (10:40 +0200)
src/config/config-parser.c

index bef2a68bd2431bd5bef2e08dad98ee59751d7658..587891df469b7faade14927fe4d7bab2df36ca04 100644 (file)
@@ -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. */