fixed variable scope issue in modcmd.c:svccmd_invoke_argv
authorpk910 <philipp@zoelle1.de>
Tue, 27 Aug 2013 20:20:45 +0000 (22:20 +0200)
committerpk910 <philipp@zoelle1.de>
Tue, 27 Aug 2013 20:20:45 +0000 (22:20 +0200)
local (block only) variable new_argv is not persistent outside of the if block on line 724!

src/modcmd.c

index a8e123a63dd9e285a52d050337e92c7646a12615..25a3fd39856cd0715cd444d6e3db9a1b5f4c8e9e 100644 (file)
@@ -721,10 +721,14 @@ svccmd_invoke_argv(struct userNode *user, struct service *service, struct chanNo
 
     /* Expand the alias arguments, if there are any. */
     if (cmd->alias.used) {
-        char *new_argv[MAXNUMPARAMS];
+        char *old_argv[MAXNUMPARAMS];
         int res;
+        unsigned int nn;
+
+        for(nn=0;nn<argc;nn++)
+            old_argv[nn] = argv[nn];
 
-        res = svccmd_expand_alias(cmd, argc, argv, new_argv);
+        res = svccmd_expand_alias(cmd, argc, old_argv, argv);
         if (res < 0) {
             send_message(user, service->bot, "MSG_MISSING_PARAMS", cmd->name);
             return 0;
@@ -733,7 +737,6 @@ svccmd_invoke_argv(struct userNode *user, struct service *service, struct chanNo
             return 0;
         }
         argc = res;
-        argv = new_argv;
 
         /* Try again to grab a handle to the channel after alias
          * expansion, overwriting any previous channel. This should,