From c07502bf5a26848fa520acda86fb538b7cd09b76 Mon Sep 17 00:00:00 2001 From: Alug Date: Thu, 23 Oct 2025 20:51:11 +0200 Subject: [PATCH] use strl instead of strn stuff to copy cecho text ALOT safer than whatever this did before --- src/hu_stuff.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/hu_stuff.c b/src/hu_stuff.c index fa7060dff..3a01aedc0 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -2845,12 +2845,8 @@ void HU_SetCEchoFlags(INT32 flags) void HU_DoCEcho(const char *msg) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstringop-truncation" // This is fine, we set null byte later - strncpy(cechotext, msg, sizeof(cechotext)); -#pragma GCC diagnostic pop - strncat(cechotext, "\\", sizeof(cechotext) - strlen(cechotext) - 1); - cechotext[sizeof(cechotext) - 1] = '\0'; + strlcpy(cechotext, msg, sizeof(cechotext)); + strlcat(cechotext, "\\", sizeof(cechotext)); // just print it to console if (cv_cechotoggle.value == 2)