summaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
author/dev/humancontroller <devhc@example.com>2015-03-18 19:05:10 +0100
committer/dev/humancontroller <devhc@example.com>2017-02-08 02:16:43 +0100
commit53b64d89f3f6f3c70e7eccc0cb5f29aec29febc1 (patch)
treef68e4b4098aa84d974594d55901a53f8ed601299 /src/server
parent6c92c1b67a8ffc05a3433b047eb5e926d6ba9e31 (diff)
protect the server against division by 0 in case of certain client rate and server timescale settings
Diffstat (limited to 'src/server')
-rw-r--r--src/server/sv_main.c5
1 files changed, 4 insertions, 1 deletions
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)