Ignore all packets from other servers instead of only snapshots

The client should only ever handle game-related packets from the server that it is currently connecting/connected to.
This commit is contained in:
Robert Müller 2024-03-23 17:51:44 +01:00
parent 87f9ccdb22
commit b264570218

View file

@ -1300,6 +1300,12 @@ static CServerCapabilities GetServerCapabilities(int Version, int Flags)
void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
{
// only allow packets from the server we actually want
if(net_addr_comp(&pPacket->m_Address, &ServerAddress()))
{
return;
}
CUnpacker Unpacker;
Unpacker.Reset(pPacket->m_pData, pPacket->m_DataSize);
CMsgPacker Packer(NETMSG_EX, true);
@ -1662,12 +1668,6 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
}
else if(Msg == NETMSG_SNAP || Msg == NETMSG_SNAPSINGLE || Msg == NETMSG_SNAPEMPTY)
{
// only allow packets from the server we actually want
if(net_addr_comp(&pPacket->m_Address, &ServerAddress()))
{
return;
}
// we are not allowed to process snapshot yet
if(State() < IClient::STATE_LOADING)
{