Module: kamailio
Branch: master
Commit: 2e7710e292a649c6c57e46d5994d3b2cf3815865
URL:
https://github.com/kamailio/kamailio/commit/2e7710e292a649c6c57e46d5994d3b2…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-09-17T14:21:30+02:00
tmx: safety check of expected route blocks for using $T_*() variables
- related to GH #2479
---
Modified: src/modules/tmx/t_var.c
---
Diff:
https://github.com/kamailio/kamailio/commit/2e7710e292a649c6c57e46d5994d3b2…
Patch:
https://github.com/kamailio/kamailio/commit/2e7710e292a649c6c57e46d5994d3b2…
---
diff --git a/src/modules/tmx/t_var.c b/src/modules/tmx/t_var.c
index 15938fcd9e..1aa1dc0cff 100644
--- a/src/modules/tmx/t_var.c
+++ b/src/modules/tmx/t_var.c
@@ -305,6 +305,11 @@ int pv_get_t_var_req(struct sip_msg *msg, pv_param_t *param,
{
pv_spec_t *pv=NULL;
+ if(!is_route_type(CORE_ONREPLY_ROUTE|TM_ONREPLY_ROUTE)) {
+ LM_DBG("used in unsupported route block - type %d\n", get_route_type());
+ return pv_get_null(msg, param, res);
+ }
+
if(pv_t_update_req(msg))
return pv_get_null(msg, param, res);
@@ -320,6 +325,11 @@ int pv_get_t_var_rpl(struct sip_msg *msg, pv_param_t *param,
{
pv_spec_t *pv=NULL;
+ if(!is_route_type(FAILURE_ROUTE|BRANCH_FAILURE_ROUTE)) {
+ LM_DBG("used in unsupported route block - type %d\n", get_route_type());
+ return pv_get_null(msg, param, res);
+ }
+
if(pv_t_update_rpl(msg))
return pv_get_null(msg, param, res);
@@ -335,6 +345,11 @@ int pv_get_t_var_branch(struct sip_msg *msg, pv_param_t *param,
{
pv_spec_t *pv=NULL;
+ if(!is_route_type(FAILURE_ROUTE|BRANCH_FAILURE_ROUTE|TM_ONREPLY_ROUTE)) {
+ LM_DBG("used in unsupported route block - type %d\n", get_route_type());
+ return pv_get_null(msg, param, res);
+ }
+
if(pv_t_update_rpl(msg))
return pv_get_null(msg, param, res);
@@ -350,6 +365,11 @@ int pv_get_t_var_inv(struct sip_msg *msg, pv_param_t *param,
{
pv_spec_t *pv=NULL;
+ if(!is_route_type(REQUEST_ROUTE)) {
+ LM_DBG("used in unsupported route block - type %d\n", get_route_type());
+ return pv_get_null(msg, param, res);
+ }
+
if(pv_t_update_inv(msg))
return pv_get_null(msg, param, res);