]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-settings: Fixed crash when trying treat strlist as having a subsection.
authorTimo Sirainen <tss@iki.fi>
Fri, 25 Mar 2011 23:10:59 +0000 (01:10 +0200)
committerTimo Sirainen <tss@iki.fi>
Fri, 25 Mar 2011 23:10:59 +0000 (01:10 +0200)
For example "plugin/foo/bar=yes" crashed, while it should have been just
ignored.

src/lib-settings/settings-parser.c

index 18d7b42351132e9af71cbe95505a038e0463d753..0b5aa4c87fdc6d03ac4551f0dea7ed1368cf357c 100644 (file)
@@ -693,8 +693,15 @@ settings_find_key_nth(struct setting_parser_context *ctx, const char *key,
                if (!settings_find_key_nth(ctx, parent_key, &parent_n,
                                           &parent_def, &parent_link))
                        return FALSE;
-               if (parent_def->type != SET_STRLIST)
-                       return FALSE;
+               if (parent_def == NULL) {
+                       /* we'll get here with e.g. "plugin/a/b=val".
+                          not sure if we should ever do anything here.. */
+                       if (strcmp(parent_link->full_key, parent_key) != 0)
+                               return FALSE;
+               } else {
+                       if (parent_def->type != SET_STRLIST)
+                               return FALSE;
+               }
 
                /* setting parent_key=0 adds it to links list */
                if (settings_parse_keyvalue(ctx, parent_key, "0") <= 0)