mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-09 09:38:19 +00:00
Disconnect when we get map change with invalid parameters
This is the only sane thing we can do, the server will have changed its map and we can't pretend to still be on the old one.
This commit is contained in:
parent
3489131d78
commit
dd5ddf07a4
|
@ -1372,15 +1372,21 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
|
|||
const char *pMap = Unpacker.GetString(CUnpacker::SANITIZE_CC | CUnpacker::SKIP_START_WHITESPACES);
|
||||
int MapCrc = Unpacker.GetInt();
|
||||
int MapSize = Unpacker.GetInt();
|
||||
if(Unpacker.Error() || MapSize < 0)
|
||||
if(Unpacker.Error())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if(MapSize < 0 || MapSize > 1024 * 1024 * 1024) // 1 GiB
|
||||
{
|
||||
DisconnectWithReason("invalid map size");
|
||||
return;
|
||||
}
|
||||
|
||||
for(int i = 0; pMap[i]; i++) // protect the player from nasty map names
|
||||
{
|
||||
if(pMap[i] == '/' || pMap[i] == '\\')
|
||||
{
|
||||
DisconnectWithReason("strange character in map name");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue