Engine: check for bitbuf overflow after reading voice data

This commit is contained in:
Kawe Mazidjatari 2024-05-31 13:44:27 +02:00
parent a839433e46
commit 45508847e3

View File

@ -537,6 +537,9 @@ bool CClient::VProcessVoiceData(CClient* pClient, CLC_VoiceData* pMsg)
char voiceDataBuffer[4096];
const int bitsRead = pMsg->m_DataIn.ReadBitsClamped(voiceDataBuffer, pMsg->m_nLength);
if (pMsg->m_DataIn.IsOverflowed())
return false;
CClient* const pAdj = AdjustShiftedThisPointer(pClient);
SV_BroadcastVoiceData(pAdj, Bits2Bytes(bitsRead), voiceDataBuffer);
#endif // !CLIENT_DLL
@ -556,6 +559,9 @@ bool CClient::VProcessDurangoVoiceData(CClient* pClient, CLC_DurangoVoiceData* p
char voiceDataBuffer[4096];
const int bitsRead = pMsg->m_DataIn.ReadBitsClamped(voiceDataBuffer, pMsg->m_nLength);
if (pMsg->m_DataIn.IsOverflowed())
return false;
CClient* const pAdj = AdjustShiftedThisPointer(pClient);
SV_BroadcastDurangoVoiceData(pAdj, Bits2Bytes(bitsRead), voiceDataBuffer,
pMsg->m_xid, pMsg->m_unknown, pMsg->m_useVoiceStream, pMsg->m_skipXidCheck);