Module: kamailio
Branch: 5.2
Commit: 7916cb92fdd12fce74dd6295890ea0bdb5ba36fd
URL:
https://github.com/kamailio/kamailio/commit/7916cb92fdd12fce74dd6295890ea0b…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Henning Westerholt <hw(a)skalatan.de>
Date: 2020-03-05T11:01:02+01:00
core: cfg.y - detect use of function call as parameter of another function
- GH #2227
(cherry picked from commit 047fdebff732c847fcde5b066ce1acd5f6c2219a)
---
Modified: src/core/cfg.y
---
Diff:
https://github.com/kamailio/kamailio/commit/7916cb92fdd12fce74dd6295890ea0b…
Patch:
https://github.com/kamailio/kamailio/commit/7916cb92fdd12fce74dd6295890ea0b…
---
diff --git a/src/core/cfg.y b/src/core/cfg.y
index 3e4bafad97..502ca92e0c 100644
--- a/src/core/cfg.y
+++ b/src/core/cfg.y
@@ -3358,8 +3358,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) {
@@ -3383,6 +3389,7 @@ cmd:
}
$$ = mod_func_action;
set_cfg_pos($$);
+ mod_func_action = NULL;
}
| ID error { yyerror("'('')' expected (function call)");}
;