[iortcw] 16/89: All: Range check client number for trap_BotUserCommand

Simon McVittie smcv at debian.org
Fri Sep 8 10:44:16 UTC 2017


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

smcv pushed a commit to tag 1.51b
in repository iortcw.

commit 5168397ea7768314bbb45495919f86431d196b01
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date:   Tue Jun 13 14:33:40 2017 -0400

    All: Range check client number for trap_BotUserCommand
---
 MP/code/server/sv_game.c | 8 +++++++-
 SP/code/server/sv_game.c | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/MP/code/server/sv_game.c b/MP/code/server/sv_game.c
index e868901..d1204a0 100644
--- a/MP/code/server/sv_game.c
+++ b/MP/code/server/sv_game.c
@@ -485,7 +485,13 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) {
 	case BOTLIB_GET_CONSOLE_MESSAGE:
 		return SV_BotGetConsoleMessage( args[1], VMA( 2 ), args[3] );
 	case BOTLIB_USER_COMMAND:
-		SV_ClientThink( &svs.clients[args[1]], VMA( 2 ) );
+		{
+			int clientNum = args[1];
+
+			if ( clientNum >= 0 && clientNum < sv_maxclients->integer ) {
+				SV_ClientThink( &svs.clients[clientNum], VMA(2) );
+			}
+		}
 		return 0;
 
 	case BOTLIB_AAS_ENTITY_INFO:
diff --git a/SP/code/server/sv_game.c b/SP/code/server/sv_game.c
index 9e8f379..952cddc 100644
--- a/SP/code/server/sv_game.c
+++ b/SP/code/server/sv_game.c
@@ -481,7 +481,13 @@ intptr_t SV_GameSystemCalls( intptr_t *args ) {
 	case BOTLIB_GET_CONSOLE_MESSAGE:
 		return SV_BotGetConsoleMessage( args[1], VMA( 2 ), args[3] );
 	case BOTLIB_USER_COMMAND:
-		SV_ClientThink( &svs.clients[args[1]], VMA( 2 ) );
+		{
+			int clientNum = args[1];
+
+			if ( clientNum >= 0 && clientNum < sv_maxclients->integer ) {
+				SV_ClientThink( &svs.clients[clientNum], VMA(2) );
+			}
+		}
 		return 0;
 
 	case BOTLIB_AAS_ENTITY_INFO:

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



More information about the Pkg-games-commits mailing list