From 2caede509971772603e6c2ff1bfe1d9809b6310e Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Sun, 16 Apr 2023 15:51:16 +0200 Subject: [PATCH] Add asserts in CSocketCreator --- r5dev/tier2/socketcreator.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/r5dev/tier2/socketcreator.cpp b/r5dev/tier2/socketcreator.cpp index bf86e998..29ebca82 100644 --- a/r5dev/tier2/socketcreator.cpp +++ b/r5dev/tier2/socketcreator.cpp @@ -273,6 +273,7 @@ void CSocketCreator::CloseAcceptedSocket(int nIndex) { if (nIndex >= int(m_hAcceptedSockets.size())) { + Assert(0); return; } @@ -351,6 +352,7 @@ int CSocketCreator::GetAcceptedSocketCount(void) const //----------------------------------------------------------------------------- SocketHandle_t CSocketCreator::GetAcceptedSocketHandle(int nIndex) const { + Assert(nIndex >= 0 && nIndex < int(m_hAcceptedSockets.size())); return m_hAcceptedSockets[nIndex].m_hSocket; } @@ -361,6 +363,7 @@ SocketHandle_t CSocketCreator::GetAcceptedSocketHandle(int nIndex) const //----------------------------------------------------------------------------- const netadr_t& CSocketCreator::GetAcceptedSocketAddress(int nIndex) const { + Assert(nIndex >= 0 && nIndex < int(m_hAcceptedSockets.size())); return m_hAcceptedSockets[nIndex].m_Address; } @@ -371,5 +374,6 @@ const netadr_t& CSocketCreator::GetAcceptedSocketAddress(int nIndex) const //----------------------------------------------------------------------------- CConnectedNetConsoleData* CSocketCreator::GetAcceptedSocketData(int nIndex) const { + Assert(nIndex >= 0 && nIndex < int(m_hAcceptedSockets.size())); return m_hAcceptedSockets[nIndex].m_pData; }