]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: message-parser - Minor code cleanup to finding the end of boundary line
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 23 Apr 2020 09:10:07 +0000 (12:10 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Wed, 27 May 2020 05:28:17 +0000 (08:28 +0300)
src/lib-mail/message-parser.c

index 0f690ab689639a6e194a6b0404db9e59db9d1088..88c1b31564711a38a7d9f0c06b05f958426c61a0 100644 (file)
@@ -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;