Skip to content
This repository was archived by the owner on Sep 15, 2024. It is now read-only.

Commit 1acba6f

Browse files
protect agaisnt malformed opcodes
1 parent f1a160d commit 1acba6f

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

Scripts/Scenes/Main/NetworkManager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ public override void _Process(float delta)
3737
var packetReader = (PacketReader)cmd.Data;
3838
var opcode = (ServerPacketOpcode)packetReader.ReadByte();
3939

40+
if (!ENetClient.HandlePacket.ContainsKey(opcode))
41+
{
42+
Utils.Log($"Received malformed opcode: {opcode} (Ignoring)");
43+
break;
44+
}
45+
4046
var handlePacket = ENetClient.HandlePacket[opcode];
4147
handlePacket.Read(packetReader);
4248
handlePacket.Handle();

0 commit comments

Comments
 (0)