From 557bb5a1cea2435cfb886e5faf5317300cb89726 Mon Sep 17 00:00:00 2001 From: Ludwig Nussel Date: Sun, 19 Aug 2007 12:11:39 +0000 Subject: [PATCH] fix null termination out of array bounds --- code/game/ai_cmd.c | 2 +- code/game/ai_team.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/code/game/ai_cmd.c b/code/game/ai_cmd.c index 29242841..db954858 100644 --- a/code/game/ai_cmd.c +++ b/code/game/ai_cmd.c @@ -1308,7 +1308,7 @@ void BotMatch_StartTeamLeaderShip(bot_state_t *bs, bot_match_t *match) { //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)] = '\0'; + bs->teamleader[sizeof(bs->teamleader)-1] = '\0'; } //chats for someone else else { diff --git a/code/game/ai_team.c b/code/game/ai_team.c index 35578a15..858c16cd 100644 --- a/code/game/ai_team.c +++ b/code/game/ai_team.c @@ -1960,7 +1960,7 @@ void BotTeamAI(bot_state_t *bs) { BotSayVoiceTeamOrder(bs, -1, VOICECHAT_STARTLEADER); ClientName(bs->client, netname, sizeof(netname)); strncpy(bs->teamleader, netname, sizeof(bs->teamleader)); - bs->teamleader[sizeof(bs->teamleader)] = '\0'; + bs->teamleader[sizeof(bs->teamleader)-1] = '\0'; bs->becometeamleader_time = 0; } return;