From 143ed804863d96684ca79dd250546cb84ed34c9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Nordstr=C3=B6m?= Date: Fri, 14 Dec 2012 15:43:22 +0100 Subject: Fix multipart parser when the boundary is not fully read yet --- src/cowboy_multipart.erl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/cowboy_multipart.erl') diff --git a/src/cowboy_multipart.erl b/src/cowboy_multipart.erl index 83c41a8..7363054 100644 --- a/src/cowboy_multipart.erl +++ b/src/cowboy_multipart.erl @@ -204,8 +204,8 @@ parse_body(Bin, Pattern = {{P, PSize}, _}) when byte_size(Bin) >= PSize -> %% next input onto tail of current input binary. {body, Bin, fun () -> parse_body(<<>>, Pattern) end}; {BoundaryStart, Len} -> - PBody = binary:part(Bin, BoundaryStart, Len), - Rest = binary:part(Bin, 0, BoundaryStart), + PBody = binary:part(Bin, 0, BoundaryStart), + Rest = binary:part(Bin, BoundaryStart, Len), {body, PBody, fun () -> parse_body(Rest, Pattern) end} end end; -- cgit v1.2.3