]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
crash fix for use of $*/$0-9 when not in an alias, patch from KadaverJack
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 5 Feb 2006 05:17:54 +0000 (05:17 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Sun, 5 Feb 2006 05:17:54 +0000 (05:17 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@5943 d7cf8633-e32d-0410-b094-e92efae38249

cmd.c

diff --git a/cmd.c b/cmd.c
index a985130159a16f6989f27632d1cf79b9ccf7ee68..c1839648f26a2404d6704942b0d16baf3c9028da 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -434,8 +434,12 @@ static void Cmd_PreprocessString( const char *intext, char *outtext, unsigned ma
                        // $<number> 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() ) {