dovecot: Infinite looping fixes

dovecot at dovecot.org dovecot at dovecot.org
Mon Oct 29 22:59:54 EET 2007


details:   http://hg.dovecot.org/dovecot/rev/ac0e7f713d70
changeset: 6654:ac0e7f713d70
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Oct 29 22:59:49 2007 +0200
description:
Infinite looping fixes

diffstat:

1 file changed, 10 insertions(+), 2 deletions(-)
src/lib-mail/message-parser.c |   12 ++++++++++--

diffs (41 lines):

diff -r 947a8a032371 -r ac0e7f713d70 src/lib-mail/message-parser.c
--- a/src/lib-mail/message-parser.c	Sun Oct 28 21:29:19 2007 +0200
+++ b/src/lib-mail/message-parser.c	Mon Oct 29 22:59:49 2007 +0200
@@ -443,6 +443,7 @@ static int parse_next_header(struct mess
 {
 	struct message_part *part = ctx->part;
 	struct message_header_line *hdr;
+	size_t size;
 	int ret;
 
 	if (ctx->skip > 0) {
@@ -451,8 +452,11 @@ static int parse_next_header(struct mess
 	}
 
 	ret = message_parse_header_next(ctx->hdr_parser_ctx, &hdr);
-	if (ret == 0 || (ret < 0 && ctx->input->stream_errno != 0))
+	if (ret == 0 || (ret < 0 && ctx->input->stream_errno != 0)) {
+		(void)i_stream_get_data(ctx->input, &size);
+		ctx->want_count = size + 1;
 		return ret;
+	}
 
 	if (hdr != NULL) {
 		if (hdr->eoh)
@@ -628,11 +632,15 @@ static int preparsed_parse_next_header(s
 				       struct message_block *block_r)
 {
 	struct message_header_line *hdr;
+	size_t size;
 	int ret;
 
 	ret = message_parse_header_next(ctx->hdr_parser_ctx, &hdr);
-	if (ret == 0 || (ret < 0 && ctx->input->stream_errno != 0))
+	if (ret == 0 || (ret < 0 && ctx->input->stream_errno != 0)) {
+		(void)i_stream_get_data(ctx->input, &size);
+		ctx->want_count = size + 1;
 		return ret;
+	}
 
 	if (hdr != NULL) {
 		block_r->hdr = hdr;


More information about the dovecot-cvs mailing list