diff options
author | M. Kristall <mkpdev@gmail.com> | 2009-10-03 12:17:11 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:15:49 +0000 |
commit | 4b04c5ef971d12e258ca0b06f3bb0eb0cc453f06 (patch) | |
tree | 77e967f64e2aaa051669d93724e3fab22aa111f8 /src/game/g_cmds.c | |
parent | 96df518d3c63da5a3ae76bdc90de225ca5ff0b42 (diff) |
* Fix out of bounds error
Diffstat (limited to 'src/game/g_cmds.c')
-rw-r--r-- | src/game/g_cmds.c | 7 |
1 files 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 ) |