diff --git a/fuzz/fuzz_form.py b/fuzz/fuzz_form.py index c990639..9a3d854 100644 --- a/fuzz/fuzz_form.py +++ b/fuzz/fuzz_form.py @@ -29,8 +29,15 @@ def parse_form_urlencoded(fdp: EnhancedDataProvider) -> None: def parse_multipart_form_data(fdp: EnhancedDataProvider) -> None: - header = {"Content-Type": "multipart/form-data; boundary=--boundary"} - parse_form(header, io.BytesIO(fdp.ConsumeRandomBytes()), on_field, on_file) + boundary = "boundary" + header = {"Content-Type": f"multipart/form-data; boundary={boundary}"} + body = ( + f"--{boundary}\r\n" + f"Content-Type: multipart/form-data; boundary={boundary}\r\n\r\n" + f"{fdp.ConsumeRandomString()}\r\n" + f"--{boundary}--\r\n" + ) + parse_form(header, io.BytesIO(body.encode("latin1", errors="ignore")), on_field, on_file) def TestOneInput(data: bytes) -> None: