From 17c29909503e866fe8aab2c4476fb9f34cc2c12e Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 5 Nov 2013 20:11:11 +0200 Subject: [PATCH] lib-mail: Fixed infinite loop in message-parser if message ends with --boundary+CR Thanks to Tomasz Potega for finding this. --- src/lib-mail/message-parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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--; } -- 2.47.3