fix null termination out of array bounds
This commit is contained in:
parent
3992f1a59c
commit
557bb5a1ce
2 changed files with 2 additions and 2 deletions
|
@ -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
|
//get the team mate that will be the team leader
|
||||||
trap_BotMatchVariable(match, NETNAME, teammate, sizeof(teammate));
|
trap_BotMatchVariable(match, NETNAME, teammate, sizeof(teammate));
|
||||||
strncpy(bs->teamleader, teammate, sizeof(bs->teamleader));
|
strncpy(bs->teamleader, teammate, sizeof(bs->teamleader));
|
||||||
bs->teamleader[sizeof(bs->teamleader)] = '\0';
|
bs->teamleader[sizeof(bs->teamleader)-1] = '\0';
|
||||||
}
|
}
|
||||||
//chats for someone else
|
//chats for someone else
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1960,7 +1960,7 @@ void BotTeamAI(bot_state_t *bs) {
|
||||||
BotSayVoiceTeamOrder(bs, -1, VOICECHAT_STARTLEADER);
|
BotSayVoiceTeamOrder(bs, -1, VOICECHAT_STARTLEADER);
|
||||||
ClientName(bs->client, netname, sizeof(netname));
|
ClientName(bs->client, netname, sizeof(netname));
|
||||||
strncpy(bs->teamleader, netname, sizeof(bs->teamleader));
|
strncpy(bs->teamleader, netname, sizeof(bs->teamleader));
|
||||||
bs->teamleader[sizeof(bs->teamleader)] = '\0';
|
bs->teamleader[sizeof(bs->teamleader)-1] = '\0';
|
||||||
bs->becometeamleader_time = 0;
|
bs->becometeamleader_time = 0;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue