Module: kamailio
Branch: 5.3
Commit: fd1d0db7c11e453b808e53102a6792082977bece
URL:
https://github.com/kamailio/kamailio/commit/fd1d0db7c11e453b808e53102a67920…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-03-04T12:28:12+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/fd1d0db7c11e453b808e53102a67920…
Patch:
https://github.com/kamailio/kamailio/commit/fd1d0db7c11e453b808e53102a67920…
---
diff --git a/src/core/cfg.y b/src/core/cfg.y
index 2275b18018..3a0f0286a7 100644
--- a/src/core/cfg.y
+++ b/src/core/cfg.y
@@ -3387,8 +3387,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) {
@@ -3412,6 +3418,7 @@ cmd:
}
$$ = mod_func_action;
set_cfg_pos($$);
+ mod_func_action = NULL;
}
| ID error { yyerror("'('')' expected (function call)");}
;