From: Timo Sirainen Date: Tue, 5 Nov 2013 18:11:11 +0000 (+0200) Subject: lib-mail: Fixed infinite loop in message-parser if message ends with --boundary+CR X-Git-Tag: 2.2.8~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=17c29909503e866fe8aab2c4476fb9f34cc2c12e;p=thirdparty%2Fdovecot%2Fcore.git lib-mail: Fixed infinite loop in message-parser if message ends with --boundary+CR Thanks to Tomasz Potega for finding this. --- diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c index c011e51831..8863356158 100644 --- a/src/lib-mail/message-parser.c +++ b/src/lib-mail/message-parser.c @@ -403,7 +403,7 @@ static int parse_next_body_to_boundary(struct message_parser_ctx *ctx, } else if (boundary_start == 0) { /* no linefeeds in this block. we can just skip it. */ ret = 0; - if (block_r->data[block_r->size-1] == '\r') { + if (block_r->data[block_r->size-1] == '\r' && !ctx->eof) { /* this may be the beginning of the \r\n--boundary */ block_r->size--; }