From 25be44840ecdf4b2399dacc0d431de181333260d Mon Sep 17 00:00:00 2001 From: James Frowen Date: Sun, 18 Oct 2020 22:07:10 +0100 Subject: [PATCH] checking if incoming message has length 0 before checking its id (#2336) --- Assets/Mirror/Runtime/NetworkConnection.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Assets/Mirror/Runtime/NetworkConnection.cs b/Assets/Mirror/Runtime/NetworkConnection.cs index 5fc4e3ae5..1df4c89b9 100644 --- a/Assets/Mirror/Runtime/NetworkConnection.cs +++ b/Assets/Mirror/Runtime/NetworkConnection.cs @@ -265,6 +265,12 @@ public bool InvokeHandler(T msg, int channelId) where T : NetworkMessage /// The data received. internal void TransportReceive(ArraySegment buffer, int channelId) { + if (buffer.Count == 0) + { + logger.LogError($"ConnectionRecv {this} Message was empty"); + return; + } + // unpack message using (PooledNetworkReader networkReader = NetworkReaderPool.GetReader(buffer)) {