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

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


details:   http://hg.dovecot.org/dovecot-1.2/rev/360ade35792f
changeset: 8103:360ade35792f
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 277aadb0ef8c -r 360ade35792f src/lib-mail/message-parser.c
--- a/src/lib-mail/message-parser.c	Fri Aug 22 01:15:13 2008 +0300
+++ b/src/lib-mail/message-parser.c	Fri Aug 22 02:24:38 2008 +0300
@@ -336,6 +336,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. */
@@ -380,6 +381,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