From 509e7140e3ba7144832fcf60f06bc49fcfdfb730 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 27 Oct 2025 21:20:39 +0100 Subject: [PATCH] use strlcpy for filling playerinfo names MAXPLAYERNAME+1 so it copies 21 and null terminates the last --- src/d_clisrv.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/d_clisrv.c b/src/d_clisrv.c index 61afc0eb7..a88954867 100644 --- a/src/d_clisrv.c +++ b/src/d_clisrv.c @@ -1656,12 +1656,7 @@ static void SV_SendPlayerInfo(INT32 node) netbuffer->u.playerinfo[i].node = i; - // Can't really change this because net compatibility, but the warning is annoying -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wstringop-truncation" - strncpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1); -#pragma GCC diagnostic pop - netbuffer->u.playerinfo[i].name[MAXPLAYERNAME] = '\0'; + strlcpy(netbuffer->u.playerinfo[i].name, (const char *)&player_names[i], MAXPLAYERNAME+1); //fetch IP address //No, don't do that, you fuckface.