]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap-parser: Don't return early if line ends with CR but there's no LF.
authorTimo Sirainen <tss@iki.fi>
Tue, 26 May 2009 01:22:55 +0000 (21:22 -0400)
committerTimo Sirainen <tss@iki.fi>
Tue, 26 May 2009 01:22:55 +0000 (21:22 -0400)
--HG--
branch : HEAD

src/lib-imap/imap-parser.c

index 2d6bb85d1b1df0b6c012f086399039e61911eec4..8c5fed7060dbbfc770232777aef707a06d1b9e95 100644 (file)
@@ -453,6 +453,15 @@ static int imap_parser_read_arg(struct imap_parser *parser)
 
                switch (data[0]) {
                case '\r':
+                       if (data_size == 1) {
+                               /* wait for LF */
+                               return FALSE;
+                       }
+                       if (data[1] != '\n') {
+                               parser->error = "CR sent without LF";
+                               return FALSE;
+                       }
+                       /* fall through */
                case '\n':
                        /* unexpected end of line */
                        parser->eol = TRUE;