changeset 17337:8568cacb0d03

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.
author Timo Sirainen <tss@iki.fi>
date Wed, 07 May 2014 19:47:12 +0300
parents fc627348087e
children 21f9679214ac
files src/lib-imap/imap-parser.c
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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;