Repository navigation
fix(net): return oslNetPostForm's reply as a whole string - #164
Merged
Merged
Conversation
oslNetPostForm read the reply with a single sceHttpReadData of up to responsesize bytes. Nothing terminated it, so a caller treating it as a string read past the buffer; and one read returns only what has arrived, so a reply longer than a packet came back cut, as a success (a read error after the first packet went unseen). On failure the buffer kept whatever it held. It now reads until the end or until responsesize - 1 bytes, and terminates the reply; the reply is empty until read in full, so it is empty when the post fails. The return value stays 1 on success. test_net: a fake whose reads return 8 bytes at a time; no reply was terminated before, and a read error after the first read returned success. httpget in PPSSPP (real HTTP, 20000-byte reply): unterminated before; in full, cut to 99 characters, and empty after a 404 now.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
Summary
Found while doing #160: what
oslNetPostFormhands back inresponse.A single read only returns what has arrived, so a reply longer than one packet came back cut and still counted as a success. A read error after the first packet went unnoticed. The buffer was never terminated, so a caller printing it read past its end.
Evidence
Host
test_net, with a fakesceHttpReadDatathat returns at most 8 bytes per call (like packets). The buffer starts as'x', so a missing terminator shows:httpgetin PPSSPP (real HTTP toserver.py;/formreplies with 20000 letters):The existing
httpgetcases and all 7 host tests pass.Merge Danger
Door: two-way.
Blast Radius: network
responsenow holds at mostresponsesize - 1characters plus the terminator. A caller that relied on getting exactlyresponsesizebytes gets one fewer.responseis an empty string instead of whatever it held before.