dovecot-2.0: lib-mail: Previous message parser optimization caus...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 15 18:07:20 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/14a6e526900d
changeset: 12121:14a6e526900d
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Sep 15 16:07:15 2010 +0100
description:
lib-mail: Previous message parser optimization caused infinite looping with some mails.

diffstat:

 src/lib-mail/message-parser.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (28 lines):

diff -r 8b6b0412dc18 -r 14a6e526900d src/lib-mail/message-parser.c
--- a/src/lib-mail/message-parser.c	Tue Sep 14 21:12:08 2010 +0100
+++ b/src/lib-mail/message-parser.c	Wed Sep 15 16:07:15 2010 +0100
@@ -369,15 +369,19 @@
 		}
 	}
 
-	if (next == NULL) {
+	if (next != NULL) {
+		/* found / need more data */
+		i_assert(ret >= 0);
+		i_assert(!(ret == 0 && full));
+	} else if (boundary_start == 0) {
+		/* no linefeeds in this block. we can just skip it. */
+		ret = 0;
+		boundary_start = block_r->size;
+	} else {
 		/* the boundary wasn't found from this data block,
 		   we'll need more data. */
 		ret = 0;
 		ctx->want_count = (block_r->size - boundary_start) + 1;
-	} else {
-		/* found / need more data */
-		i_assert(ret >= 0);
-		i_assert(!(ret == 0 && full));
 	}
 
 	if (ret > 0 || (ret == 0 && !ctx->eof)) {


More information about the dovecot-cvs mailing list