From: Timo Sirainen Date: Thu, 23 Apr 2020 09:10:07 +0000 (+0300) Subject: lib-mail: message-parser - Minor code cleanup to finding the end of boundary line X-Git-Tag: 2.3.11.2~52 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=14633032cfc7501b212667789506f2fb5340d2bc;p=thirdparty%2Fdovecot%2Fcore.git lib-mail: message-parser - Minor code cleanup to finding the end of boundary line --- diff --git a/src/lib-mail/message-parser.c b/src/lib-mail/message-parser.c index 0f690ab689..88c1b31564 100644 --- a/src/lib-mail/message-parser.c +++ b/src/lib-mail/message-parser.c @@ -211,17 +211,16 @@ boundary_line_find(struct message_parser_ctx *ctx, } /* need to find the end of line */ - if (memchr(data + 2, '\n', size - 2) == NULL && - size < BOUNDARY_END_MAX_LEN && + data += 2; + size -= 2; + if (memchr(data, '\n', size) == NULL && + size+2 < BOUNDARY_END_MAX_LEN && !ctx->input->eof && !full) { /* no LF found */ ctx->want_count = BOUNDARY_END_MAX_LEN; return 0; } - data += 2; - size -= 2; - *boundary_r = boundary_find(ctx->boundaries, data, size); if (*boundary_r == NULL) return -1;