dovecot-2.0: lib-settings: Fixed crash when trying treat strlist...

dovecot at dovecot.org dovecot at dovecot.org
Sat Mar 26 01:11:01 EET 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/746b4e9e7015
changeset: 12707:746b4e9e7015
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Mar 26 01:10:59 2011 +0200
description:
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.

diffstat:

 src/lib-settings/settings-parser.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (21 lines):

diff -r 0d437e2e6949 -r 746b4e9e7015 src/lib-settings/settings-parser.c
--- a/src/lib-settings/settings-parser.c	Sat Mar 26 00:42:48 2011 +0200
+++ b/src/lib-settings/settings-parser.c	Sat Mar 26 01:10:59 2011 +0200
@@ -693,8 +693,15 @@
 		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)


More information about the dovecot-cvs mailing list