From: bones_was_here Date: Fri, 29 Dec 2023 09:35:25 +0000 (+1000) Subject: Fix worldmessage string truncation X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e23e10816221de25540362beb52e41a3ad8e4c49;p=xonotic%2Fdarkplaces.git Fix worldmessage string truncation Signed-off-by: bones_was_here --- diff --git a/client.h b/client.h index a7b275ca..02ac81ff 100644 --- a/client.h +++ b/client.h @@ -894,7 +894,7 @@ typedef struct client_state_s char sound_name[MAX_SOUNDS][MAX_QPATH]; // for display on solo scoreboard - char worldmessage[40]; // map title (not related to filename) + char worldmessage[MAX_QPATH]; // map title (not related to filename) // variants of map name char worldbasename[MAX_QPATH]; // %s char worldname[MAX_QPATH]; // maps/%s.bsp diff --git a/sbar.c b/sbar.c index 88ccfc31..7b914d84 100644 --- a/sbar.c +++ b/sbar.c @@ -682,7 +682,7 @@ static void Sbar_SoloScoreboard (void) Sbar_DrawString(8+22*8, 4, va(vabuf, sizeof(vabuf), "Secrets:%3i", cl.stats[STAT_SECRETS])); // format is like this: e1m1:The Sligpate Complex - dpsnprintf(str, sizeof(str), "%s:%s", cl.worldbasename, cl.worldmessage); + dpsnprintf(str, sizeof(str), "%s:%.39s", cl.worldbasename, cl.worldmessage); // if there's a newline character, terminate the string there if (strchr(str, '\n')) diff --git a/server.h b/server.h index d1cdb1ab..729418d9 100644 --- a/server.h +++ b/server.h @@ -108,7 +108,6 @@ typedef struct server_s /// map name char name[64]; // %s followed by entrance name // variants of map name - char worldmessage[40]; // map title (not related to filename) char worldbasename[MAX_QPATH]; // %s char worldname[MAX_QPATH]; // maps/%s.bsp char worldnamenoextension[MAX_QPATH]; // maps/%s diff --git a/sv_main.c b/sv_main.c index 8dad80ed..65ba374d 100644 --- a/sv_main.c +++ b/sv_main.c @@ -2091,9 +2091,8 @@ void SV_SpawnServer (const char *map) } } - // update the map title cvar - dp_strlcpy(sv.worldmessage, PRVM_GetString(prog, PRVM_serveredictstring(prog->edicts, message)), sizeof(sv.worldmessage)); // map title (not related to filename) - Cvar_SetQuick(&sv_worldmessage, sv.worldmessage); + // update the map title cvar (not related to filename) + Cvar_SetQuick(&sv_worldmessage, PRVM_GetString(prog, PRVM_serveredictstring(prog->edicts, message))); Con_Printf("Server spawned.\n"); NetConn_Heartbeat (2);