Merge pull request #14797 from acts-1631/security/netplay-buffer-limit

NetPlay: reject oversized input buffer messages
This commit is contained in:
Admiral H. Curtiss
2026-10-03 11:08:09 +02:00
committed by GitHub
3 changed files with 10 additions and 2 deletions
+7 -2
View File
@@ -754,8 +754,13 @@ void NetPlayClient::OnPadBuffer(sf::Packet& packet)
u32 size = 0;
packet >> size;
m_target_buffer_size = size;
m_dialog->OnPadBufferChanged(size);
if (size > MAX_TARGET_PAD_BUFFER_SIZE)
{
WARN_LOG_FMT(NETPLAY, "Ignoring invalid pad buffer size {}.", size);
return;
}
AdjustPadBufferSize(size);
}
void NetPlayClient::OnHostInputAuthority(sf::Packet& packet)
+1
View File
@@ -244,6 +244,7 @@ enum class SyncCodeID : u8
};
constexpr u32 MAX_NAME_LENGTH = 30;
constexpr u32 MAX_TARGET_PAD_BUFFER_SIZE = 99;
constexpr size_t CHUNKED_DATA_UNIT_SIZE = 16384;
constexpr u32 MAX_ENET_MTU = 1392; // see https://github.com/lsalzman/enet/issues/132
@@ -33,6 +33,7 @@
#include "Common/Logging/Log.h"
#include "Common/TraversalClient.h"
#include "Core/NetPlayCommon.h"
#include "Core/NetPlayProto.h"
#include "Core/Boot/Boot.h"
#include "Core/Config/GraphicsSettings.h"
@@ -130,6 +131,7 @@ void NetPlayDialog::CreateMainLayout()
m_game_button = new QPushButton;
m_start_button = new QPushButton(tr("Start"));
m_buffer_size_box = new QSpinBox;
m_buffer_size_box->setMaximum(NetPlay::MAX_TARGET_PAD_BUFFER_SIZE);
m_buffer_label = new QLabel(tr("Buffer:"));
m_quit_button = new QPushButton(tr("Quit"));
m_splitter = new QSplitter(Qt::Horizontal);