From 8582406dd2f27d7e9e7c810cca15993b09a41f36 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 9 May 2017 19:57:21 +0100 Subject: [PATCH 1/2] prevent invalid nodes from crashing Net_CloseConnection, print a warning and return instead --- src/d_net.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/d_net.c b/src/d_net.c index 7f16c302..98fe71ab 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -716,6 +716,12 @@ void Net_CloseConnection(INT32 node) if (!node) return; + if (node >= MAXNETNODES) // prevent invalid nodes from crashing the game + { + CONS_Alert(CONS_WARNING, M_GetText("Net_CloseConnection: invalid node %d detected!\n"), node); + return; + } + nodes[node].flags |= NF_CLOSE; // try to Send ack back (two army problem) From 96c63bf95b66061d84e8b71ed1679a8180a3c477 Mon Sep 17 00:00:00 2001 From: Monster Iestyn Date: Tue, 9 May 2017 20:02:42 +0100 Subject: [PATCH 2/2] Whoops forgot this bit too --- src/d_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_net.c b/src/d_net.c index 98fe71ab..70cdc5f1 100644 --- a/src/d_net.c +++ b/src/d_net.c @@ -716,7 +716,7 @@ void Net_CloseConnection(INT32 node) if (!node) return; - if (node >= MAXNETNODES) // prevent invalid nodes from crashing the game + if (node < 0 || node >= MAXNETNODES) // prevent invalid nodes from crashing the game { CONS_Alert(CONS_WARNING, M_GetText("Net_CloseConnection: invalid node %d detected!\n"), node); return;