engine: validate size of the message before passing it to COM_UnMunge2

This commit is contained in:
Alibek Omarov
2026-05-23 19:41:54 +05:00
parent 3a6e3ba3ca
commit 8b89bdca6f

View File

@@ -1781,8 +1781,8 @@ qboolean Netchan_Process( netchan_t *chan, sizebuf_t *msg )
uint sequence = MSG_ReadLong( msg );
uint sequence_ack = MSG_ReadLong( msg );
if( chan->use_munge )
COM_UnMunge2( msg->pData + 8, ( msg->nDataBits >> 3 ) - 8, sequence & 0xFF );
if( chan->use_munge && MSG_GetMaxBytes( msg ) >= 8 )
COM_UnMunge2( msg->pData + 8, MSG_GetMaxBytes( msg ) - 8, sequence & 0xFF );
// read the qport if we are a server
if( chan->sock == NS_SERVER )