diff options
author | Ben Millwood <thebenmachine@gmail.com> | 2010-04-18 15:52:59 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:17:35 +0000 |
commit | 00812ef4617697f15632a068439193b044c1b5cd (patch) | |
tree | 8b89f05428dffb65dfbacd77253922586678c2bd /src/game/g_cmds.c | |
parent | 2f9f1045ac6e4c33ea86429fb69e3be351dfaee0 (diff) |
* (bug 4090) fix G_ClientNumbersFromString on an empty argument
* faff about with const in strtol and strtod (see bug 4598)
Diffstat (limited to 'src/game/g_cmds.c')
-rw-r--r-- | src/game/g_cmds.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index d194c142..c9cb889c 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -154,17 +154,20 @@ int G_ClientNumbersFromString( char *s, int *plist, int max ) { gclient_t *p; int i, found = 0; + char *endptr; char n2[ MAX_NAME_LENGTH ] = {""}; char s2[ MAX_NAME_LENGTH ] = {""}; if( max == 0 ) return 0; + if( !s[ 0 ] ) + return 0; + // if a number is provided, it is a clientnum - for( i = 0; s[ i ] && isdigit( s[ i ] ); i++ ); - if( !s[ i ] ) + i = strtol( s, &endptr, 10 ); + if( *endptr == '\0' ) { - i = atoi( s ); if( i >= 0 && i < level.maxclients ) { p = &level.clients[ i ]; |