From: havoc Date: Sun, 5 Feb 2006 05:17:54 +0000 (+0000) Subject: crash fix for use of $*/$0-9 when not in an alias, patch from KadaverJack X-Git-Tag: xonotic-v0.1.0preview~4359 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=277905aa3468bafbe549fa717f60ab6e4109231c crash fix for use of $*/$0-9 when not in an alias, patch from KadaverJack git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5943 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cmd.c b/cmd.c index a9851301..c1839648 100644 --- a/cmd.c +++ b/cmd.c @@ -434,8 +434,12 @@ static void Cmd_PreprocessString( const char *intext, char *outtext, unsigned ma // $ is replaced with an argument to this alias (or copied as-is if no such parameter exists), can be multiple digits if( *in == '$' ) { outtext[outlen++] = *in++; - } else if( *in == '*' && alias ) { + } else if( *in == '*' ) { const char *linein = Cmd_Args(); + + if( !alias ) + continue; + // include all params if (linein) { while( *linein && outlen < maxoutlen ) { @@ -444,10 +448,13 @@ static void Cmd_PreprocessString( const char *intext, char *outtext, unsigned ma } in++; - } else if( '0' <= *in && *in <= '9' && alias ) { + } else if( '0' <= *in && *in <= '9' ) { char *nexttoken; int argnum; + if( !alias ) + continue; + argnum = strtol( in, &nexttoken, 10 ); if( 0 <= argnum && argnum < Cmd_Argc() ) {