From ca9cf25423b1da21ab74e2ee52377a68f8d51c7a Mon Sep 17 00:00:00 2001 From: James R Date: Sat, 5 Sep 2020 23:23:54 -0700 Subject: [PATCH] Fix netid overflow check --- src/command.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/command.c b/src/command.c index d3e0e4969..ded854e49 100644 --- a/src/command.c +++ b/src/command.c @@ -1262,12 +1262,12 @@ void CV_RegisterVar(consvar_t *variable) // check net variables if (variable->flags & CV_NETVAR) { - variable->netid = ++consvar_number_of_netids; - /* in case of overflow... */ - if (variable->netid > consvar_number_of_netids) + if (consvar_number_of_netids + 1 < consvar_number_of_netids) I_Error("Way too many netvars"); + variable->netid = ++consvar_number_of_netids; + #ifdef OLD22DEMOCOMPAT CV_RegisterOldDemoVar(variable); #endif