From 1c808a2835ff959dbd6685756853389c2fa3b63b Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 26 Jan 2016 21:03:35 +0100 Subject: [PATCH] NetPlayServer: Possible out-of-bounds access on invalid input if a pad or wiimote number was outside bounds (e.g. 42353543232), it would still have been read from the array, which could lead to inappropriate consequences, like a segfault. --- Source/Core/Core/NetPlayServer.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/Core/Core/NetPlayServer.cpp b/Source/Core/Core/NetPlayServer.cpp index a77ba7e489..49bc559d06 100644 --- a/Source/Core/Core/NetPlayServer.cpp +++ b/Source/Core/Core/NetPlayServer.cpp @@ -504,8 +504,10 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player) // If the data is not from the correct player, // then disconnect them. - if (m_pad_map[map] != player.pid) + if (m_pad_map.at(map) != player.pid) + { return 1; + } // Relay to clients sf::Packet spac; @@ -531,7 +533,7 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player) // If the data is not from the correct player, // then disconnect them. - if (m_wiimote_map[map] != player.pid) + if (m_wiimote_map.at(map) != player.pid) { return 1; }