From 93b847a079fcbcbe6e727c481f060306c7e30a17 Mon Sep 17 00:00:00 2001 From: Acts1631 Date: Tue, 15 Sep 2026 15:58:52 -0400 Subject: [PATCH] server: reject invalid spectator targets safely --- src/game/server.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/game/server.cpp b/src/game/server.cpp index bc72b7d62..a6878f6a3 100644 --- a/src/game/server.cpp +++ b/src/game/server.cpp @@ -7628,7 +7628,12 @@ namespace server int sn = getint(p), val = getint(p); clientinfo *cp = (clientinfo *)getinfo(sn); - if(!cp || (val ? (cp->state == CS_SPECTATOR || cp->actortype > A_PLAYER) : cp->state != CS_SPECTATOR)) + if(!cp) + { + srvmsgf(ci->clientnum, colourorange, "Sync error: unable to modify spectator - %d - invalid", sn); + break; + } + if(val ? (cp->state == CS_SPECTATOR || cp->actortype > A_PLAYER) : cp->state != CS_SPECTATOR) { srvmsgf(ci->clientnum, colourorange, "Sync error: %s unable to modify spectator - %d [%d, %d] - invalid", colourname(cp), cp->state, cp->lastdeath, gamemillis); break;