Repository navigation
Fix php-cgi -b accepting ports above 65535 - #25235
Open
eyupcanakman wants to merge 1 commit into
Open
eyupcanakman wants to merge 1 commit into
eyupcanakman wants to merge 1 commit into
Conversation
fcgi_listen() read the port with atoi() into a short and did not check its range, so a port above 65535 or below 0 wrapped to another port. php-cgi -b 70000 listened on port 4464. Reject such ports, as phpGH-24616 did for socket transports. The -b error exits in main() returned without shutting the module down, which leaked. Jump to parent_out instead, like the error paths further down.
eyupcanakman
force-pushed
the
fastcgi-port-range
branch
from
November 6, 2026 17:19
85c5968 to
35309ed
Compare
Contributor
Author
|
The ASAN jobs failed because php-cgi returned from main() without shutting the module down when -b fails, so the leak showed up in the test output. A busy port leaks the same way on PHP-8.4. Both -b error exits now go through parent_out. |
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.
php-cgi -breads the port infcgi_listen()withatoi()into ashort, so a port outside 0-65535 wraps to another one.-b 70000listens on port 4464, and-b 65536creates a Unix socket named65536.Such ports now fail with the existing error. GH-24616 fixed the same thing for socket streams.