Replace strncpy usage with Q_strncpyz

This commit is contained in:
Zack Middleton authored and Tim Angus committed 2025-07-24 09:47:13 +01:00
1 parent c8553223ec
commit 1132abe3dc
10 files changed
+16 -34

No files matched your search

+2 -4
View File
@@ -1105,8 +1105,7 @@ void BotMatch_JoinSubteam(bot_state_t *bs, bot_match_t *match) {
//get the sub team name
trap_BotMatchVariable(match, TEAMNAME, teammate, sizeof(teammate));
//set the sub team name
strncpy(bs->subteam, teammate, 32);
bs->subteam[31] = '\0';
Q_strncpyz(bs->subteam, teammate, sizeof(bs->subteam));
//
trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));
BotAI_BotInitialChat(bs, "joinedteam", teammate, NULL);
@@ -1297,8 +1296,7 @@ void BotMatch_StartTeamLeaderShip(bot_state_t *bs, bot_match_t *match) {
if (match->subtype & ST_I) {
//get the team mate that will be the team leader
trap_BotMatchVariable(match, NETNAME, teammate, sizeof(teammate));
strncpy(bs->teamleader, teammate, sizeof(bs->teamleader));
bs->teamleader[sizeof(bs->teamleader)-1] = '\0';
Q_strncpyz(bs->teamleader, teammate, sizeof(bs->teamleader));
}
//chats for someone else
else {