Skip to content

NetPlay: reject oversized input buffer messages - #14797

Open
acts-1631 wants to merge 2 commits into
dolphin-emu:masterfrom
acts-1631:security/netplay-buffer-limit
Open

NetPlay: reject oversized input buffer messages#14797
acts-1631 wants to merge 2 commits into
dolphin-emu:masterfrom
acts-1631:security/netplay-buffer-limit

Conversation

@acts-1631

Copy link
Copy Markdown
Contributor

OnPadBuffer() accepts the PadBuffer value received from the host and passes it directly to AdjustPadBufferSize(). 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.

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 Dentomologist left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread Source/Core/Core/NetPlayProto.h Outdated
};

constexpr u32 MAX_NAME_LENGTH = 30;
constexpr u32 MAX_BUFFER_SIZE = 99;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
@acts-1631

Copy link
Copy Markdown
Contributor Author

Thanks, good point. I added a follow-up commit that renames the limit and uses it to set the spin box maximum.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants