diff --git a/rehlds/engine/common.cpp b/rehlds/engine/common.cpp index c9f07a656..d51dc59ec 100644 --- a/rehlds/engine/common.cpp +++ b/rehlds/engine/common.cpp @@ -1185,7 +1185,6 @@ void *EXT_FUNC SZ_GetSpace(sizebuf_t *buf, int length) void *data; const char *buffername = buf->buffername ? buf->buffername : "???"; - if (length < 0) { Sys_Error("%s: %i negative length on %s", __func__, length, buffername); @@ -1239,13 +1238,18 @@ void *EXT_FUNC SZ_GetSpace(sizebuf_t *buf, int length) #endif // REHLDS_FIXES Con_Printf("%s: overflow on %s\n", __func__, buffername); - + Log_Printf("%s, ovewflow on %s\n", __func__, buffername); + SZ_Clear(buf); buf->flags |= SIZEBUF_OVERFLOWED; } data = &buf->data[buf->cursize]; buf->cursize = length + buf->cursize; + + unsigned char *wtf = (unsigned char *)data; + + Log_Printf("%s, ovewflow on %s | buf: %d\n", __func__, buffername, wtf); return data; } diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 9c9ce2966..e18421ab4 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -4744,7 +4744,9 @@ qboolean SV_SendClientDatagram(client_t *client) SV_WriteClientdataToMessage(client, &msg); SV_WriteEntitiesToClient(client, &msg); - + + Log_Printf("%s, ovewflow | buf: %d\n", __func__, buf); + if (client->datagram.flags & SIZEBUF_OVERFLOWED) { Con_Printf("WARNING: datagram overflowed for %s\n", client->name);