Server: fix protocol size checks for sounds and particles

6643f532bd
This commit is contained in:
Andrei Drexler 2022-06-25 20:56:10 +03:00 committed by Ozkan Sezer
parent 3581ff989d
commit fe15bc1ddd

View file

@ -152,7 +152,7 @@ void SV_StartParticle (vec3_t org, vec3_t dir, int color, int count)
{
int i, v;
if (sv.datagram.cursize > MAX_DATAGRAM-16)
if (sv.datagram.cursize > MAX_DATAGRAM-18)
return;
MSG_WriteByte (&sv.datagram, svc_particle);
MSG_WriteCoord (&sv.datagram, org[0], sv.protocolflags);
@ -200,7 +200,7 @@ void SV_StartSound (edict_t *entity, int channel, const char *sample, int volume
if (channel < 0 || channel > 7)
Host_Error ("SV_StartSound: channel = %i", channel);
if (sv.datagram.cursize > MAX_DATAGRAM-16)
if (sv.datagram.cursize > MAX_DATAGRAM-21)
return;
// find precache number for sound
@ -239,6 +239,9 @@ void SV_StartSound (edict_t *entity, int channel, const char *sample, int volume
}
//johnfitz
if (sv.datagram.cursize > MAX_DATAGRAM-21)
return;
// directed messages go only to the entity the are targeted on
MSG_WriteByte (&sv.datagram, svc_sound);
MSG_WriteByte (&sv.datagram, field_mask);
@ -293,6 +296,9 @@ void SV_LocalSound (client_t *client, const char *sample)
field_mask = SND_LARGESOUND;
}
if (client->message.cursize > client->message.maxsize-4)
return;
MSG_WriteByte (&client->message, svc_localsound);
MSG_WriteByte (&client->message, field_mask);
if (field_mask & SND_LARGESOUND)