dovecot-2.0: imap parser: Fail immediately if we see unexpected ...

dovecot at dovecot.org dovecot at dovecot.org
Thu May 20 10:25:50 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/01f81b9e9586
changeset: 11345:01f81b9e9586
user:      Timo Sirainen <tss at iki.fi>
date:      Thu May 20 09:25:47 2010 +0200
description:
imap parser: Fail immediately if we see unexpected ')' while reading atom.

diffstat:

 src/lib-imap/imap-parser.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (20 lines):

diff -r 2b5af8843142 -r 01f81b9e9586 src/lib-imap/imap-parser.c
--- a/src/lib-imap/imap-parser.c	Thu May 20 09:15:49 2010 +0200
+++ b/src/lib-imap/imap-parser.c	Thu May 20 09:25:47 2010 +0200
@@ -264,11 +264,13 @@
 			imap_parser_save_arg(parser, data, i);
 			break;
 		} else if (data[i] == ')') {
-			if (parser->list_arg != NULL ||
-			    (parser->flags &
-			     IMAP_PARSE_FLAG_ATOM_ALLCHARS) == 0) {
+			if (parser->list_arg != NULL) {
 				imap_parser_save_arg(parser, data, i);
 				break;
+			} else if ((parser->flags &
+				    IMAP_PARSE_FLAG_ATOM_ALLCHARS) == 0) {
+				parser->error = "Unexpected ')'";
+				return FALSE;
 			}
 			/* assume it's part of the atom */
 		} else if (!is_valid_atom_char(parser, data[i]))


More information about the dovecot-cvs mailing list