Drop and log sync orders with mismatching length

This commit is contained in:
abcdefg30
2020-10-11 20:27:52 +02:00
committed by abcdefg30
parent c17110dac5
commit 1bc19e788c
3 changed files with 23 additions and 4 deletions

View File

@@ -123,8 +123,16 @@ namespace OpenRA.Network
var frame = BitConverter.ToInt32(packet, 0);
if (packet.Length == 5 && packet[4] == (byte)OrderType.Disconnect)
frameData.ClientQuit(clientId, frame);
else if (packet.Length == 4 + Order.SyncHashOrderLength && packet[4] == (byte)OrderType.SyncHash)
else if (packet.Length > 4 && packet[4] == (byte)OrderType.SyncHash)
{
if (packet.Length != 4 + Order.SyncHashOrderLength)
{
Log.Write("debug", "Dropped sync order with length {0}. Expected length {1}.".F(packet.Length, 4 + Order.SyncHashOrderLength));
return;
}
CheckSync(packet);
}
else if (frame == 0)
immediatePackets.Add((clientId, packet));
else