Do not drop clients reporting unparsable IP addresses.

This commit is contained in:
Ray Koopa 2020-07-12 17:40:36 +02:00
parent 180a61a147
commit d0a01c6a13

View File

@ -391,7 +391,7 @@ namespace Syroot.Worms.Worms2.GameServer
return;
// Require valid room ID and IP.
if (connection.RemoteEndPoint.Address.Equals(IPAddress.Parse(packet.Data)))
if (IPAddress.TryParse(packet.Data, out IPAddress ip) && connection.RemoteEndPoint.Address.Equals(ip))
{
Game newGame = new Game(++_lastID, fromUser.Name, fromUser.Session.Nation, fromUser.RoomID,
connection.RemoteEndPoint.Address, // do not use bad NAT IP reported by users here