From a6808de96c18d744550bf9ce0b48ef4f3dc12d00 Mon Sep 17 00:00:00 2001
From: LJ Sonic <lamr@free.fr>
Date: Mon, 10 Jan 2022 20:12:27 +0100
Subject: [PATCH] Fix message sending code using hardcoded buffer size

---
 src/hu_stuff.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/hu_stuff.c b/src/hu_stuff.c
index a6341ff290..32ca59e6a6 100644
--- a/src/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -897,7 +897,7 @@ static boolean HU_chatboxContainsOnlySpaces(void)
 
 static void HU_sendChatMessage(void)
 {
-	char buf[2+256];
+	char buf[2 + HU_MAXMSGLEN + 1];
 	char *msg = &buf[2];
 	size_t ci;
 	INT32 target = 0;
@@ -975,7 +975,7 @@ static void HU_sendChatMessage(void)
 
 		// we need to get rid of the /pm<player num>
 		newmsg = msg+5+spc;
-		strlcpy(msg, newmsg, 255);
+		strlcpy(msg, newmsg, HU_MAXMSGLEN + 1);
 	}
 	if (ci > 2) // don't send target+flags+empty message.
 	{
-- 
GitLab