From bc465faadaa1a318c822b0d2f74d4ddfc4a4c555 Mon Sep 17 00:00:00 2001 From: GenericHeroGuy Date: Sun, 5 Apr 2026 20:53:20 +0200 Subject: [PATCH] And now for my own personal take on COM_CEcho_f Actually works, is properly centered, allows 1023 characters instead of 1022! --- src/command.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/command.c b/src/command.c index aecbe5ae8..a602fe886 100644 --- a/src/command.c +++ b/src/command.c @@ -810,12 +810,14 @@ static void COM_Echo_f(void) static void COM_CEcho_f(void) { size_t i; - char cechotext[1024] = ""; + char cechotext[1024]; - for (i = 1; i < COM_Argc(); i++) + strlcpy(cechotext, COM_Argc() > 1 ? COM_Argv(1) : "", sizeof(cechotext)); + + for (i = 2; i < COM_Argc(); i++) { - strlcpy(cechotext, COM_Argv(i), sizeof(cechotext)-1); - strlcpy(cechotext, " ", sizeof(cechotext)-1); + strlcat(cechotext, " ", sizeof(cechotext)); + strlcat(cechotext, COM_Argv(i), sizeof(cechotext)); } HU_DoCEcho(cechotext);