[ioquake3] 05/10: fix a few potential buffer overwrite in Game VM

Simon McVittie smcv at debian.org
Sun Dec 17 18:29:08 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag debian/1.36+u20171216_dfsg-1
in repository ioquake3.

commit c904f6d4aa2ba2760b1ab7a5a2bba5b0d1d28631
Author: David CARLIER <devnexen at gmail.com>
Date:   Sat Dec 16 18:51:34 2017 +0000

    fix a few potential buffer overwrite in Game VM
---
 code/game/g_bot.c    | 8 ++++----
 code/game/g_client.c | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/code/game/g_bot.c b/code/game/g_bot.c
index b5731a6..b6b205f 100644
--- a/code/game/g_bot.c
+++ b/code/game/g_bot.c
@@ -817,19 +817,19 @@ void Svcmd_BotList_f( void ) {
 
 	trap_Print("^1name             model            aifile              funname\n");
 	for (i = 0; i < g_numBots; i++) {
-		strcpy(name, Info_ValueForKey( g_botInfos[i], "name" ));
+		Q_strncpyz(name, Info_ValueForKey( g_botInfos[i], "name" ), sizeof( name ));
 		if ( !*name ) {
 			strcpy(name, "UnnamedPlayer");
 		}
-		strcpy(funname, Info_ValueForKey( g_botInfos[i], "funname" ));
+		Q_strncpyz(funname, Info_ValueForKey( g_botInfos[i], "funname" ), sizeof( funname ));
 		if ( !*funname ) {
 			strcpy(funname, "");
 		}
-		strcpy(model, Info_ValueForKey( g_botInfos[i], "model" ));
+		Q_strncpyz(model, Info_ValueForKey( g_botInfos[i], "model" ), sizeof( model ));
 		if ( !*model ) {
 			strcpy(model, "visor/default");
 		}
-		strcpy(aifile, Info_ValueForKey( g_botInfos[i], "aifile"));
+		Q_strncpyz(aifile, Info_ValueForKey( g_botInfos[i], "aifile"), sizeof( aifile ));
 		if (!*aifile ) {
 			strcpy(aifile, "bots/default_c.c");
 		}
diff --git a/code/game/g_client.c b/code/game/g_client.c
index 457e058..c6a0e87 100644
--- a/code/game/g_client.c
+++ b/code/game/g_client.c
@@ -838,11 +838,11 @@ void ClientUserinfoChanged( int clientNum ) {
 	teamLeader = client->sess.teamLeader;
 
 	// colors
-	strcpy(c1, Info_ValueForKey( userinfo, "color1" ));
-	strcpy(c2, Info_ValueForKey( userinfo, "color2" ));
+	Q_strncpyz(c1, Info_ValueForKey( userinfo, "color1" ), sizeof( c1 ));
+	Q_strncpyz(c2, Info_ValueForKey( userinfo, "color2" ), sizeof( c2 ));
 
-	strcpy(redTeam, Info_ValueForKey( userinfo, "g_redteam" ));
-	strcpy(blueTeam, Info_ValueForKey( userinfo, "g_blueteam" ));
+	Q_strncpyz(redTeam, Info_ValueForKey( userinfo, "g_redteam" ), sizeof( redTeam ));
+	Q_strncpyz(blueTeam, Info_ValueForKey( userinfo, "g_blueteam" ), sizeof( blueTeam ));
 	
 	// send over a subset of the userinfo keys so other clients can
 	// print scoreboards, display models, and play custom sounds

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git



More information about the Pkg-games-commits mailing list