From 4b04c5ef971d12e258ca0b06f3bb0eb0cc453f06 Mon Sep 17 00:00:00 2001
From: "M. Kristall" <mkpdev@gmail.com>
Date: Sat, 3 Oct 2009 12:17:11 +0000
Subject: * Fix out of bounds error

---
 src/game/g_cmds.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index c9bbf465..e9052b05 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -179,7 +179,10 @@ int G_ClientNumbersFromString( char *s, int *plist, int max )
   char n2[ MAX_NAME_LENGTH ] = {""};
   char s2[ MAX_NAME_LENGTH ] = {""};
 
-  // if a number is provided, it might be a slot #
+  if( max == 0 )
+    return 0;
+
+  // if a number is provided, it is a clientnum
   for( i = 0; s[ i ] && isdigit( s[ i ] ); i++ );
   if( !s[ i ] )
   {
@@ -201,7 +204,7 @@ int G_ClientNumbersFromString( char *s, int *plist, int max )
   G_SanitiseString( s, s2, sizeof( s2 ) );
   if( strlen( s2 ) < 1 )
     return 0;
-  for( i = 0; i < level.maxclients && found <= max; i++ )
+  for( i = 0; i < level.maxclients && found < max; i++ )
   {
     p = &level.clients[ i ];
     if( p->pers.connected == CON_DISCONNECTED )
-- 
cgit