From 75e4f07e12a52386bf57177f892b420f9f423e64 Mon Sep 17 00:00:00 2001 From: LJ Sonic Date: Mon, 10 Jan 2022 19:31:41 +0100 Subject: [PATCH] Fix say command and its variants 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 a2f069b77..2b38697c4 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -464,7 +464,7 @@ void HU_AddChatText(const char *text, boolean playsound) static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags) { - char buf[254]; + char buf[2 + HU_MAXMSGLEN + 1]; size_t numwords, ix; char *msg = &buf[2]; const size_t msgspace = sizeof buf - 2; @@ -541,7 +541,7 @@ static void DoSayCommand(SINT8 target, size_t usedargs, UINT8 flags) } buf[0] = target; newmsg = msg+5+spc; - strlcpy(msg, newmsg, 252); + strlcpy(msg, newmsg, HU_MAXMSGLEN + 1); } SendNetXCmd(XD_SAY, buf, strlen(msg) + 1 + msg-buf);