ext/session: reject non-numeric session.upload_progress.freq#22579
Open
jorgsowa wants to merge 2 commits into
Open
ext/session: reject non-numeric session.upload_progress.freq#22579jorgsowa wants to merge 2 commits into
jorgsowa wants to merge 2 commits into
Conversation
OnUpdateRfc1867Freq used ZEND_ATOL(), which silently truncates trailing garbage (e.g. "5 apples" becomes 5), the same parsing bug recently fixed for session.cookie_lifetime. Switch to is_numeric_string_ex() to validate the numeric portion strictly, still allowing the optional trailing "%" for percentage mode.
Covers the "%"-suffixed form of session.upload_progress.freq, alongside the plain-integer case added in rfc1867_invalid_settings_3.phpt.
Girgias
reviewed
Jul 3, 2026
| int new_freq = ZEND_ATOL(ZSTR_VAL(new_value)); | ||
| const char *str = ZSTR_VAL(new_value); | ||
| size_t len = ZSTR_LEN(new_value); | ||
| bool is_percentage = len > 0 && str[len - 1] == '%'; |
Member
There was a problem hiding this comment.
What happens with trailing spaces? Not sure how our INI parser deals with those.
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.
OnUpdateRfc1867Freqsilently truncates trailing characters (e.g. "5 apples" becomes 5), the same parsing bug recently fixed for session.cookie_lifetime. Switch tois_numeric_string_ex()to validate the numeric portion strictly, still allowing the optional trailing "%" for percentage mode.