From 53b64d89f3f6f3c70e7eccc0cb5f29aec29febc1 Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Wed, 18 Mar 2015 19:05:10 +0100 Subject: protect the server against division by 0 in case of certain client rate and server timescale settings --- src/server/sv_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/sv_main.c b/src/server/sv_main.c index 0c4c7f46..16bae3ab 100644 --- a/src/server/sv_main.c +++ b/src/server/sv_main.c @@ -1181,7 +1181,10 @@ int SV_RateMsec(client_t *client) else messageSize += UDPIP_HEADER_SIZE; - rateMsec = messageSize * 1000 / ((int) (rate * com_timescale->value)); + rate = (int)(rate * com_timescale->value); + if(rate < 1) + rate = 1; + rateMsec = messageSize * 1000 / rate; rate = Sys_Milliseconds() - client->netchan.lastSentTime; if(rate > rateMsec) -- cgit