engine: client: fix FlushEntityPacket message overflow on legacy servers
This commit is contained in:
parent
f67b97e63c
commit
25d6b2b069
1 changed files with 23 additions and 14 deletions
|
@ -654,6 +654,24 @@ FRAME PARSING
|
||||||
|
|
||||||
=========================================================================
|
=========================================================================
|
||||||
*/
|
*/
|
||||||
|
static qboolean CL_ParseEntityNumFromPacket( sizebuf_t *msg, int *newnum )
|
||||||
|
{
|
||||||
|
if( cls.legacymode )
|
||||||
|
{
|
||||||
|
*newnum = MSG_ReadWord( msg );
|
||||||
|
if( *newnum == 0 )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
|
||||||
|
if( *newnum == LAST_EDICT )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=================
|
=================
|
||||||
CL_FlushEntityPacket
|
CL_FlushEntityPacket
|
||||||
|
@ -674,8 +692,8 @@ void CL_FlushEntityPacket( sizebuf_t *msg )
|
||||||
// read it all, but ignore it
|
// read it all, but ignore it
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
|
if( !CL_ParseEntityNumFromPacket( msg, &newnum ))
|
||||||
if( newnum == LAST_EDICT ) break; // done
|
break; // done
|
||||||
|
|
||||||
if( MSG_CheckOverflow( msg ))
|
if( MSG_CheckOverflow( msg ))
|
||||||
Host_Error( "CL_FlushEntityPacket: overflow\n" );
|
Host_Error( "CL_FlushEntityPacket: overflow\n" );
|
||||||
|
@ -847,21 +865,12 @@ int CL_ParsePacketEntities( sizebuf_t *msg, qboolean delta )
|
||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
int lastedict;
|
if( !CL_ParseEntityNumFromPacket( msg, &newnum ))
|
||||||
if( cls.legacymode )
|
break; // done
|
||||||
{
|
|
||||||
newnum = MSG_ReadWord( msg );
|
|
||||||
lastedict = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
newnum = MSG_ReadUBitLong( msg, MAX_ENTITY_BITS );
|
|
||||||
lastedict = LAST_EDICT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( newnum == lastedict ) break; // end of packet entities
|
|
||||||
if( MSG_CheckOverflow( msg ))
|
if( MSG_CheckOverflow( msg ))
|
||||||
Host_Error( "CL_ParsePacketEntities: overflow\n" );
|
Host_Error( "CL_ParsePacketEntities: overflow\n" );
|
||||||
|
|
||||||
player = CL_IsPlayerIndex( newnum );
|
player = CL_IsPlayerIndex( newnum );
|
||||||
|
|
||||||
while( oldnum < newnum )
|
while( oldnum < newnum )
|
||||||
|
|
Loading…
Add table
Reference in a new issue