]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: Fixed infinite loop in message-parser if message ends with --boundary+CR
authorTimo Sirainen <tss@iki.fi>
Tue, 5 Nov 2013 18:11:11 +0000 (20:11 +0200)
committerTimo Sirainen <tss@iki.fi>
Tue, 5 Nov 2013 18:11:11 +0000 (20:11 +0200)
Thanks to Tomasz Potega for finding this.

src/lib-mail/message-parser.c

index c011e518311ff688d6605544b2db3c5840113381..8863356158833b843549ccd3760c67c6db46aaca 100644 (file)
@@ -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--;
                }