aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorroot <root@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-17 17:04:18 +0000
committerroot <root@f38db490-d61c-443f-a65b-d21fe96a405b>2006-08-17 17:04:18 +0000
commit62245abb42c1e23df30e8bb1b80920750fcfc7b6 (patch)
treee36954c956687a3adbab21029aedffbf065aae6e /apps
parentc63394201df4e4c1aef4898db6b31d513fa80dd6 (diff)
automerge commit
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2-netsec@40253 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r--apps/app_macro.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/apps/app_macro.c b/apps/app_macro.c
index 4fb336025..0ac2d097f 100644
--- a/apps/app_macro.c
+++ b/apps/app_macro.c
@@ -101,8 +101,8 @@ static int macro_exec(struct ast_channel *chan, void *data)
int oldpriority;
char pc[80], depthc[12];
char oldcontext[AST_MAX_CONTEXT] = "";
- char *offsets;
- int offset, depth;
+ char *offsets, *s;
+ int offset, depth = 0, maxdepth = 7;
int setmacrocontext=0;
int autoloopflag, dead = 0;
@@ -119,6 +119,11 @@ static int macro_exec(struct ast_channel *chan, void *data)
LOCAL_USER_ADD(u);
+ /* does the user want a deeper rabbit hole? */
+ s = pbx_builtin_getvar_helper(chan, "MACRO_RECURSION");
+ if (s)
+ sscanf(s, "%d", &maxdepth);
+
/* Count how many levels deep the rabbit hole goes */
tmp = pbx_builtin_getvar_helper(chan, "MACRO_DEPTH");
if (tmp) {
@@ -127,7 +132,7 @@ static int macro_exec(struct ast_channel *chan, void *data)
depth = 0;
}
- if (depth >= 20) {
+ if (depth >= maxdepth) {
ast_log(LOG_ERROR, "Macro(): possible infinite loop detected. Returning early.\n");
LOCAL_USER_REMOVE(u);
return 0;