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.
This commit is contained in:
mathieui 2016-01-26 21:03:35 +01:00
parent 8e1be37feb
commit 1c808a2835

View File

@ -504,8 +504,10 @@ unsigned int NetPlayServer::OnData(sf::Packet& packet, Client& player)
// If the data is not from the correct player, // If the data is not from the correct player,
// then disconnect them. // then disconnect them.
if (m_pad_map[map] != player.pid) if (m_pad_map.at(map) != player.pid)
{
return 1; return 1;
}
// Relay to clients // Relay to clients
sf::Packet spac; 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, // If the data is not from the correct player,
// then disconnect them. // then disconnect them.
if (m_wiimote_map[map] != player.pid) if (m_wiimote_map.at(map) != player.pid)
{ {
return 1; return 1;
} }