From c41ca4d824903febf7aa2a3bdd80d83ecb4eba65 Mon Sep 17 00:00:00 2001 From: vis2k Date: Fri, 8 Jun 2018 11:46:49 +0200 Subject: [PATCH] ConnectionArray list index access bug fixed where index == count would be allowed --- Unity-Technologies-networking/Runtime/ConnectionArray.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Unity-Technologies-networking/Runtime/ConnectionArray.cs b/Unity-Technologies-networking/Runtime/ConnectionArray.cs index 4f466ceee..e5fb6e53d 100644 --- a/Unity-Technologies-networking/Runtime/ConnectionArray.cs +++ b/Unity-Technologies-networking/Runtime/ConnectionArray.cs @@ -56,7 +56,7 @@ public NetworkConnection Get(int connId) return m_LocalConnections[Mathf.Abs(connId) - 1]; } - if (connId < 0 || connId > m_Connections.Count) + if (connId >= connections.Count) { if (LogFilter.logWarn) { Debug.LogWarning("ConnectionArray Get invalid index " + connId); } return null; @@ -68,7 +68,7 @@ public NetworkConnection Get(int connId) // call this if the connection may not exist (in disconnect handler) public NetworkConnection GetUnsafe(int connId) { - if (connId < 0 || connId > m_Connections.Count) + if (connId < 0 || connId >= m_Connections.Count) { return null; } @@ -83,7 +83,7 @@ public void Remove(int connId) return; } - if (connId < 0 || connId > m_Connections.Count) + if (connId < 0 || connId >= m_Connections.Count) { if (LogFilter.logWarn) { Debug.LogWarning("ConnectionArray Remove invalid index " + connId); } return;