dovecot-1.1: Fixed infinite looping when parsing some (not all) ...

dovecot at dovecot.org dovecot at dovecot.org
Fri Aug 22 02:24:44 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/1b188a25ca83
changeset: 7827:1b188a25ca83
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Aug 22 02:24:38 2008 +0300
description:
Fixed infinite looping when parsing some (not all) broken multipart mails
that didn't end with proper --boundary--.

diffstat:

1 file changed, 4 insertions(+)
src/lib-mail/message-parser.c |    4 ++++

diffs (21 lines):

diff -r c5292984a0c1 -r 1b188a25ca83 src/lib-mail/message-parser.c
--- a/src/lib-mail/message-parser.c	Fri Aug 22 01:14:11 2008 +0300
+++ b/src/lib-mail/message-parser.c	Fri Aug 22 02:24:38 2008 +0300
@@ -335,6 +335,7 @@ static int parse_next_body_to_boundary(s
 		}
 	}
 
+	i_assert(block_r->size > 0);
 	for (i = boundary_start = 0; i < block_r->size; i++) {
 		/* skip to beginning of the next line. the first line was
 		   handled already. */
@@ -379,6 +380,9 @@ static int parse_next_body_to_boundary(s
 			ret = 0;
 			ctx->want_count = (block_r->size - boundary_start) + 1;
 		}
+	} else if (ret == 0 && eof) {
+		/* we can't get any more data */
+		ret = -1;
 	}
 	i_assert(!(ret == 0 && full));
 


More information about the dovecot-cvs mailing list