Repository navigation
Conversation
skip_upload was declared outside the multipart while loop and never reset between parts, so a single file part with
malformed brackets caused all subsequent valid file parts in the same request to be silently skipped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
rfc1867_post_handler()(main/rfc1867.c),skip_uploadis declared outside the multipartwhileloop and never reset. Once a file part triggers it, for example a field name with malformed brackets such asname="bad[", every later file part in the same request is skipped as well, while later non-file fields are still parsed into$_POST.This moves
skip_uploadinto the loop body so it is evaluated per part. The!PG(file_uploads)andupload_cnt <= 0branches set it again on each iteration, so their behavior is unchanged.Adds
tests/basic/rfc1867_malformed_bracket_skip_upload.phpt: a malformed file part followed by a valid one and a plain field. It fails before the fix ($_FILESis empty) and passes after.Note: I found this through source inspection with an automated/LLM-assisted tool, then reproduced and verified it myself.