diff --git a/r5dev/engine/client/cl_rcon.cpp b/r5dev/engine/client/cl_rcon.cpp index 47c73480..12fdb2f9 100644 --- a/r5dev/engine/client/cl_rcon.cpp +++ b/r5dev/engine/client/cl_rcon.cpp @@ -256,7 +256,8 @@ void CRConClient::ProcessBuffer(const char* pRecvBuf, int nRecvLen, CConnectedNe pData->m_RecvBuffer[3]); pData->m_nPayloadRead = 0; - if (pData->m_nPayloadLen < 0) + if (pData->m_nPayloadLen < 0 || + pData->m_nPayloadLen > pData->m_RecvBuffer.max_size()) { Error(eDLL_T::CLIENT, "RCON Cmd: sync error (%d)\n", pData->m_nPayloadLen); this->Disconnect(); // Out of sync (irrecoverable). diff --git a/r5dev/engine/server/sv_rcon.cpp b/r5dev/engine/server/sv_rcon.cpp index 3116d2c4..e2ec24e4 100644 --- a/r5dev/engine/server/sv_rcon.cpp +++ b/r5dev/engine/server/sv_rcon.cpp @@ -404,7 +404,8 @@ void CRConServer::ProcessBuffer(const char* pRecvBuf, int nRecvLen, CConnectedNe } } - if (pData->m_nPayloadLen < 0) + if (pData->m_nPayloadLen < 0 || + pData->m_nPayloadLen > pData->m_RecvBuffer.max_size()) { Error(eDLL_T::SERVER, "RCON Cmd: sync error (%d)\n", pData->m_nPayloadLen); this->CloseConnection(); // Out of sync (irrecoverable). diff --git a/r5dev/netconsole/netconsole.cpp b/r5dev/netconsole/netconsole.cpp index 1362f7d3..39a058ee 100644 --- a/r5dev/netconsole/netconsole.cpp +++ b/r5dev/netconsole/netconsole.cpp @@ -372,7 +372,8 @@ void CNetCon::ProcessBuffer(const char* pRecvBuf, int nRecvLen, CConnectedNetCon pData->m_RecvBuffer[3]); pData->m_nPayloadRead = 0; - if (pData->m_nPayloadLen < 0) + if (pData->m_nPayloadLen < 0 || + pData->m_nPayloadLen > pData->m_RecvBuffer.max_size()) { std::cout << "RCON Cmd: sync error (" << pData->m_nPayloadLen << ")" << std::endl; this->Disconnect(); // Out of sync (irrecoverable).