Merged revisions 53093 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Thu, 1 Feb 2007 21:27:22 +0000 (21:27 +0000)
committerRussell Bryant <russell@russellbryant.com>
Thu, 1 Feb 2007 21:27:22 +0000 (21:27 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r53093 | russell | 2007-02-01 15:24:52 -0600 (Thu, 01 Feb 2007) | 2 lines

Fix the FIELDQTY function to not crash. (reported by blitzrage and Corydon on IRC)

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@53094 65c4cc65-6c06-0410-ace0-fbb531ad65f3

funcs/func_strings.c

index ff3e577..af330e6 100644 (file)
@@ -48,7 +48,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 static int function_fieldqty(struct ast_channel *chan, const char *cmd,
                             char *parse, char *buf, size_t len)
 {
-       char *varname, *varsubst, varval[8192] = "", *varval2 = varval;
+       char *varsubst, varval[8192] = "", *varval2 = varval;
        int fieldcount = 0;
        AST_DECLARE_APP_ARGS(args,
                             AST_APP_ARG(varname);
@@ -67,9 +67,9 @@ static int function_fieldqty(struct ast_channel *chan, const char *cmd,
                        else
                                ast_copy_string(args.delim, "-", 2);
                }
-               varsubst = alloca(strlen(varname) + 4);
+               varsubst = alloca(strlen(args.varname) + 4);
 
-               sprintf(varsubst, "${%s}", varname);
+               sprintf(varsubst, "${%s}", args.varname);
                pbx_substitute_variables_helper(chan, varsubst, varval, sizeof(varval) - 1);
                while (strsep(&varval2, args.delim))
                        fieldcount++;