From 16ea4c1393d0a2222a92080f80fe00e5b1c93e50 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 16 Sep 2024 11:03:03 +0200 Subject: [PATCH] prevent netvar string overflow --- src/command.c | 3 ++- src/p_saveg.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/command.c b/src/command.c index b7e1e01de..c9378d646 100644 --- a/src/command.c +++ b/src/command.c @@ -1632,8 +1632,9 @@ static void CV_SetCVar(consvar_t *var, const char *value, boolean stealth) if (var->flags & CV_NETVAR) { // send the value of the variable - UINT8 buf[128]; + UINT8 buf[512]; UINT8 *p = buf; + if (!(server || (IsPlayerAdmin(consoleplayer)))) { CONS_Printf(M_GetText("Only the server or admin can change: %s %s\n"), var->name, var->string); diff --git a/src/p_saveg.c b/src/p_saveg.c index ae3157b96..4aef22263 100644 --- a/src/p_saveg.c +++ b/src/p_saveg.c @@ -3369,7 +3369,7 @@ FUNCINLINE static ATTRINLINE boolean P_NetUnArchiveMisc(boolean reloading) // gamemap changed; we assume that its map header is always valid, // so make it so - if(!mapheaderinfo[gamemap-1]) + if (!mapheaderinfo[gamemap-1]) P_AllocMapHeader(gamemap-1); // tell the sound code to reset the music since we're skipping what