From 3ed48227d62898884b9e71baf44ad7cf9399254c Mon Sep 17 00:00:00 2001 From: Egor Date: Thu, 23 Jul 2020 14:31:47 +0300 Subject: [PATCH] skip first two boundary characters --- multipart_parser.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/multipart_parser.c b/multipart_parser.c index 981dabb..4e0b4d3 100644 --- a/multipart_parser.c +++ b/multipart_parser.c @@ -141,6 +141,9 @@ size_t multipart_parser_execute(multipart_parser* p, const char *buf, size_t len p->state = s_header_field_start; break; } + if(i < 2) { + break; // first '--' + } if (c != p->multipart_boundary[p->index]) { return i; } @@ -237,6 +240,7 @@ size_t multipart_parser_execute(multipart_parser* p, const char *buf, size_t len multipart_log("s_part_data_almost_boundary"); if (c == LF) { p->state = s_part_data_boundary; + i += 2; // first '--' p->lookbehind[1] = LF; p->index = 0; break;