Fix SZ_GetSpace server crashes

See https://github.com/Novum/vkQuake/pull/438.  Also see
    https://github.com/andrei-drexler/ironwail/issues/32

Note: Changing that 24 to 39 does prevent the crash, but
the buffer size is still insufficient, so some entities
(e.g. nails) are missing occasionally. A MAX_DATAGRAM of
48000 seems enough to fix that (MAX_DATAGRAM in ironwail
has been bumped to 64000.) Long term though, it would be
much better to add support for pkt fragmentation like in
QSS since this jumbo packet size is only used in single-
player mode - multiplayer uses the much smaller value of
DATAGRAM_MTU (just 1400 bytes.)
This commit is contained in:
temx 2022-03-11 23:55:10 +03:00 committed by Ozkan Sezer
parent 32b1ebb828
commit 6cf0547d01

View file

@ -599,7 +599,9 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
// johnfitz -- max size for protocol 15 is 18 bytes, not 16 as originally // johnfitz -- max size for protocol 15 is 18 bytes, not 16 as originally
// assumed here. And, for protocol 85 the max size is actually 24 bytes. // assumed here. And, for protocol 85 the max size is actually 24 bytes.
if (msg->cursize + 24 > msg->maxsize) // For float coords and angles the limit is 39.
// FIXME: Use tighter limit according to protocol flags and send bits.
if (msg->cursize + 39 > msg->maxsize)
{ {
//johnfitz -- less spammy overflow message //johnfitz -- less spammy overflow message
if (!dev_overflows.packetsize || dev_overflows.packetsize + CONSOLE_RESPAM_TIME < realtime ) if (!dev_overflows.packetsize || dev_overflows.packetsize + CONSOLE_RESPAM_TIME < realtime )