r1126 - trunk/code/game

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Sun Aug 19 08:11:39 EDT 2007


Author: ludwig
Date: 2007-08-19 08:11:39 -0400 (Sun, 19 Aug 2007)
New Revision: 1126

Modified:
   trunk/code/game/ai_cmd.c
   trunk/code/game/ai_team.c
Log:
fix null termination out of array bounds


Modified: trunk/code/game/ai_cmd.c
===================================================================
--- trunk/code/game/ai_cmd.c	2007-08-19 12:05:17 UTC (rev 1125)
+++ trunk/code/game/ai_cmd.c	2007-08-19 12:11:39 UTC (rev 1126)
@@ -1308,7 +1308,7 @@
 		//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 {

Modified: trunk/code/game/ai_team.c
===================================================================
--- trunk/code/game/ai_team.c	2007-08-19 12:05:17 UTC (rev 1125)
+++ trunk/code/game/ai_team.c	2007-08-19 12:11:39 UTC (rev 1126)
@@ -1960,7 +1960,7 @@
 				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;




More information about the quake3-commits mailing list