mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Add max size bounds for PayLoadLen when setting size of m_RecvBuffer
Should technically never fail, but in case it does it won't crash the application.
This commit is contained in:
parent
3f8476db88
commit
9ba5e63ada
@ -256,7 +256,8 @@ void CRConClient::ProcessBuffer(const char* pRecvBuf, int nRecvLen, CConnectedNe
|
|||||||
pData->m_RecvBuffer[3]);
|
pData->m_RecvBuffer[3]);
|
||||||
pData->m_nPayloadRead = 0;
|
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);
|
Error(eDLL_T::CLIENT, "RCON Cmd: sync error (%d)\n", pData->m_nPayloadLen);
|
||||||
this->Disconnect(); // Out of sync (irrecoverable).
|
this->Disconnect(); // Out of sync (irrecoverable).
|
||||||
|
@ -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);
|
Error(eDLL_T::SERVER, "RCON Cmd: sync error (%d)\n", pData->m_nPayloadLen);
|
||||||
this->CloseConnection(); // Out of sync (irrecoverable).
|
this->CloseConnection(); // Out of sync (irrecoverable).
|
||||||
|
@ -372,7 +372,8 @@ void CNetCon::ProcessBuffer(const char* pRecvBuf, int nRecvLen, CConnectedNetCon
|
|||||||
pData->m_RecvBuffer[3]);
|
pData->m_RecvBuffer[3]);
|
||||||
pData->m_nPayloadRead = 0;
|
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;
|
std::cout << "RCON Cmd: sync error (" << pData->m_nPayloadLen << ")" << std::endl;
|
||||||
this->Disconnect(); // Out of sync (irrecoverable).
|
this->Disconnect(); // Out of sync (irrecoverable).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user