dovecot-1.1: If cached message part showed header's size to be s...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 2 21:20:26 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.1/rev/f27e6f583817
changeset: 7597:f27e6f583817
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 02 21:06:27 2008 +0300
description:
If cached message part showed header's size to be smaller than in reality,
return "broken" instead of assert-crashing.

diffstat:

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

diffs (16 lines):

diff -r 60733457ea20 -r f27e6f583817 src/lib-mail/message-parser.c
--- a/src/lib-mail/message-parser.c	Mon Jun 02 21:00:49 2008 +0300
+++ b/src/lib-mail/message-parser.c	Mon Jun 02 21:06:27 2008 +0300
@@ -617,7 +617,11 @@ static int preparsed_parse_body_init(str
 	uoff_t offset = ctx->part->physical_pos +
 		ctx->part->header_size.physical_size;
 
-	i_assert(offset >= ctx->input->v_offset);
+	if (offset < ctx->input->v_offset) {
+		/* header was actually larger than the cached size suggested */
+		ctx->broken = TRUE;
+		return -1;
+	}
 	i_stream_skip(ctx->input, offset - ctx->input->v_offset);
 
 	ctx->parse_next_block = preparsed_parse_body_more;


More information about the dovecot-cvs mailing list