Module: kamailio Branch: master Commit: 047fdebff732c847fcde5b066ce1acd5f6c2219a URL: https://github.com/kamailio/kamailio/commit/047fdebff732c847fcde5b066ce1acd5...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2020-03-03T11:30:04+01:00
core: cfg.y - detect use of function call as parameter of another function
- GH #2227
---
Modified: src/core/cfg.y
---
Diff: https://github.com/kamailio/kamailio/commit/047fdebff732c847fcde5b066ce1acd5... Patch: https://github.com/kamailio/kamailio/commit/047fdebff732c847fcde5b066ce1acd5...
---
diff --git a/src/core/cfg.y b/src/core/cfg.y index 394386bb1b..23ab69ee08 100644 --- a/src/core/cfg.y +++ b/src/core/cfg.y @@ -3390,8 +3390,14 @@ cmd: } | CFG_RESET error { $$=0; yyerror("missing '(' or ')' ?"); } | CFG_RESET LPAREN error RPAREN { $$=0; yyerror("bad arguments, string expected"); } - | ID {mod_func_action = mk_action(MODULE0_T, 2, MODEXP_ST, NULL, NUMBER_ST, - 0); } LPAREN func_params RPAREN { + | ID { + if (mod_func_action != NULL) { + LM_ERR("function used inside params of another function: %s\n", $1); + yyerror("use of function execution inside params not allowed\n"); + exit(-1); + } + mod_func_action = mk_action(MODULE0_T, 2, MODEXP_ST, NULL, NUMBER_ST, 0); + } LPAREN func_params RPAREN { mod_func_action->val[0].u.data = find_export_record($1, mod_func_action->val[1].u.number, rt); if (mod_func_action->val[0].u.data == 0) { @@ -3415,6 +3421,7 @@ cmd: } $$ = mod_func_action; set_cfg_pos($$); + mod_func_action = NULL; } | ID error { yyerror("'('')' expected (function call)");} ;