mirror of
https://github.com/rehlds/rehlds.git
synced 2024-12-29 08:05:50 +03:00
Added overflow checks in Netchan_CopyNormalFragments
This commit is contained in:
parent
6a819c8683
commit
a3b651e54b
@ -1399,16 +1399,41 @@ qboolean Netchan_CopyNormalFragments(netchan_t *chan)
|
|||||||
SZ_Clear(&net_message);
|
SZ_Clear(&net_message);
|
||||||
MSG_BeginReading();
|
MSG_BeginReading();
|
||||||
|
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
bool overflowed = false;
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
|
|
||||||
while (p)
|
while (p)
|
||||||
{
|
{
|
||||||
n = p->next;
|
n = p->next;
|
||||||
|
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
if (net_message.cursize + p->frag_message.cursize <= net_message.maxsize)
|
||||||
|
SZ_Write(&net_message, p->frag_message.data, p->frag_message.cursize);
|
||||||
|
else
|
||||||
|
overflowed = true;
|
||||||
|
#else // REHLDS_FIXES
|
||||||
SZ_Write(&net_message, p->frag_message.data, p->frag_message.cursize);
|
SZ_Write(&net_message, p->frag_message.data, p->frag_message.cursize);
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
|
|
||||||
Mem_Free(p);
|
Mem_Free(p);
|
||||||
p = n;
|
p = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef REHLDS_FIXES
|
||||||
|
if (overflowed)
|
||||||
|
{
|
||||||
|
Con_Printf("Netchan_CopyNormalFragments: Overflowed\n");
|
||||||
|
|
||||||
|
SZ_Clear(&net_message);
|
||||||
|
|
||||||
|
chan->incomingbufs[FRAG_NORMAL_STREAM] = NULL;
|
||||||
|
chan->incomingready[FRAG_NORMAL_STREAM] = false;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#endif // REHLDS_FIXES
|
||||||
|
|
||||||
if (*(uint32 *)net_message.data == MAKEID('B', 'Z', '2', '\0'))
|
if (*(uint32 *)net_message.data == MAKEID('B', 'Z', '2', '\0'))
|
||||||
{
|
{
|
||||||
char uncompressed[65536];
|
char uncompressed[65536];
|
||||||
|
Loading…
Reference in New Issue
Block a user