NetPlay: reject oversized input buffer messages - #14797
Open
acts-1631 wants to merge 2 commits into
Open
Conversation
A NetPlay host could send an arbitrary buffer size to a client. The client then tried to allocate input states until it reached that value. Limit buffer sizes to the existing user-interface maximum. Invalid peer values are ignored.
Dentomologist
left a comment
Contributor
There was a problem hiding this comment.
Since we're capping the target pad buffer size we should explicitly call SetMaximum on NetPlayDialog::m_buffer_size_box in case we decide to change the cap later.
| }; | ||
|
|
||
| constexpr u32 MAX_NAME_LENGTH = 30; | ||
| constexpr u32 MAX_BUFFER_SIZE = 99; |
Contributor
There was a problem hiding this comment.
This name is vague; MAX_TARGET_PAD_BUFFER_SIZE is a bit verbose but clearer about what this value actually represents.
I'd argue it'd be good to change a number of existing function and variable names similarly (such as OnPadBuffer, AdjustPadBufferSize, m_target_buffer_size, etc.), but not in this PR so we can keep it focused.
Use the target pad buffer maximum for the Qt spin box. This keeps the\nuser interface limit aligned with the value used for incoming network\nmessages.
Contributor
Author
|
Thanks, good point. I added a follow-up commit that renames the limit and uses it to set the spin box maximum. |
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.
OnPadBuffer()accepts thePadBuffervalue received from the host and passes it directly toAdjustPadBufferSize(). A malicious or broken host can therefore make a client allocate input states up to an arbitrary buffer size.Define the existing UI maximum as
MAX_BUFFER_SIZE, reject larger peer values in the client, and clamp sizes on both the client and server paths. This preserves the normal 0–99 buffer range while preventing unbounded queue growth.