From: Timo Sirainen Date: Fri, 25 Mar 2011 23:10:59 +0000 (+0200) Subject: lib-settings: Fixed crash when trying treat strlist as having a subsection. X-Git-Tag: 2.0.12~33 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ff640c9b10fa5029315bdac2192134eebe2f97a3;p=thirdparty%2Fdovecot%2Fcore.git lib-settings: Fixed crash when trying treat strlist as having a subsection. For example "plugin/foo/bar=yes" crashed, while it should have been just ignored. --- diff --git a/src/lib-settings/settings-parser.c b/src/lib-settings/settings-parser.c index 18d7b42351..0b5aa4c87f 100644 --- a/src/lib-settings/settings-parser.c +++ b/src/lib-settings/settings-parser.c @@ -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)