Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PacketEncoder: add minimal validation of fcgi packets on decode #78

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rcanavan
Copy link

@rcanavan rcanavan commented May 2, 2024

Proposed Changes

When accidentally contacting a HTTP server instead of an fcgi server, Socket::readPacket() can turn into an infinite loop. This change implements a rudimentary check that the server that was contacted is actually a fcgi server.

Further comments

A proper fix would also implement a global timeout in Socket::readPacket(). On top of that, stream_select() or similar should be used in the while ( $length && ($buffer = fread loop so that it does not run as a busy loop, but I was unable to convince it to block with the HTTP server that caused the initial problem.

@rcanavan rcanavan requested a review from hollodotme as a code owner May 2, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant