foxygit / doom Log in
commit 54fb12eeaa7d527defbe65e7e00e37d5feb7c597
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Wed Jun 24 12:49:14 2020 +0200
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Wed Jun 24 12:49:14 2020 +0200

    net: fix missing client-side ticdup validation

    The client does not validate settings coming from the server. The
    ticdup value is used as a divider in arithmetic operations. If the
    server sends this value equal to zero, the client will crash with a
    Floating Pointer Exception.

    Found by Michał Dardas from LogicalTrust.

    Fixes: #1292.
---
 src/d_loop.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/d_loop.c b/src/d_loop.c
index 61a42d54..b963054a 100644
--- a/src/d_loop.c
+++ b/src/d_loop.c
@@ -413,6 +413,11 @@ void D_StartNetGame(net_gamesettings_t *settings,
     ticdup = settings->ticdup;
     new_sync = settings->new_sync;

+    if (ticdup < 1)
+    {
+        I_Error("D_StartNetGame: invalid ticdup value (%d)", ticdup);
+    }
+
     // TODO: Message disabled until we fix new_sync.
     //if (!new_sync)
     //{