Multipart parser silently drops long field names and filenames

Open
#653 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c
Domain
api, backend

Research direction

Read src/net/http/multipart.c:49-80 and src/net/http/multipart.c:102-126 to trace where fragments and Content-Disposition parameters are truncated or omitted. Add tests for long field names, filenames, and headers split across parser fragments. Done means metadata is accumulated dynamically or over-limit input is explicitly rejected, with no successful partial interpretation.

Written by the indexing model from the issue text.

Description

bug good first issue

Affected: dev at bb2a33946.

Multipart header fragments are silently truncated at 255-byte field names and 1023-byte values (src/net/http/multipart.c:49-80). Content-Disposition names and filenames of 256 bytes or more are then not copied at all (src/net/http/multipart.c:102-126). Parsing still returns success, with missing or incorrect field metadata.

Long Content-Disposition values can also be cut in the middle of a quoted parameter and interpreted differently from the sender's input.

Expected: accumulate header fragments dynamically or reject over-limit metadata explicitly; do not return a successful partial interpretation. Add tests for long field names, filenames, and headers split across parser fragments.

Dominant language
C
Stars
16
Forks
7
Avg merge
5h 39m
Merged PRs (30d)
185

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from c4punks/CWIST

All issues in c4punks/CWIST

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.