dovecot-2.2: lib-imap: IMAP parser didn't parse atoms correctly ...

dovecot at dovecot.org dovecot at dovecot.org
Wed May 7 16:47:54 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/8568cacb0d03
changeset: 17337:8568cacb0d03
user:      Timo Sirainen <tss at iki.fi>
date:      Wed May 07 19:47:12 2014 +0300
description:
lib-imap: IMAP parser didn't parse atoms correctly that started with '~' character.
literal8 begins only after "~{", not immediately after "~" which is a valid
ATOM-CHAR.

diffstat:

 src/lib-imap/imap-parser.c |  9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diffs (19 lines):

diff -r fc627348087e -r 8568cacb0d03 src/lib-imap/imap-parser.c
--- a/src/lib-imap/imap-parser.c	Wed May 07 18:39:23 2014 +0300
+++ b/src/lib-imap/imap-parser.c	Wed May 07 19:47:12 2014 +0300
@@ -594,6 +594,15 @@
 			parser->str_first_escape = -1;
 			break;
 		case '~':
+			/* This could be either literal8 or atom */
+			if (data_size == 1) {
+				/* wait for the next char */
+				return FALSE;
+			}
+			if (data[1] != '{') {
+				parser->cur_type = ARG_PARSE_ATOM;
+				break;
+			}
 			if ((parser->flags & IMAP_PARSE_FLAG_LITERAL8) == 0) {
 				parser->error = "literal8 not allowed here";
 				return FALSE;


More information about the dovecot-cvs mailing list