From ea7e39c2f0ef48ac7b0deefccfee6b36a56b2312 Mon Sep 17 00:00:00 2001 From: def Date: Sat, 18 Dec 2021 10:34:20 +0100 Subject: [PATCH] Alternative fix for cut off names (fixes #4463) https://github.com/ddnet/ddnet/pull/4465 might have more side effects --- src/engine/server/server.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index ca47b75df..28d45edec 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -400,9 +400,9 @@ bool CServer::SetClientNameImpl(int ClientID, const char *pNameRequest, bool Set // auto rename for(int i = 1;; i++) { - char aNameTryBrokenEnd[MAX_NAME_LENGTH]; - str_format(aNameTryBrokenEnd, sizeof(aNameTryBrokenEnd), "(%d)%s", i, aTrimmedName); - str_utf8_copy(aNameTry, aNameTryBrokenEnd, sizeof(aNameTry)); + char aNameTryFull[MAX_NAME_LENGTH + 4]; + str_format(aNameTryFull, sizeof(aNameTryFull), "(%d)%s", i, aTrimmedName); + str_utf8_copy(aNameTry, aNameTryFull, sizeof(aNameTry)); if(IsClientNameAvailable(ClientID, aNameTry)) break; }