use strl instead of strn stuff to copy cecho text

ALOT safer than whatever this did before
This commit is contained in:
Alug committed 2025-10-23 20:51:24 +02:00
1 parent f751161693
commit c07502bf5a
1 file changed
+2 -6
+2 -6
View File
@@ -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)