Skip to content

Commit

Permalink
tmx: safety check of expected route blocks for using $T_*() variables
Browse files Browse the repository at this point in the history
- related to GH #2479

(cherry picked from commit 2e7710e)
  • Loading branch information
miconda authored and henningw committed Oct 2, 2020
1 parent 0d0085c commit 8988b12
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/modules/tmx/t_var.c
Expand Up @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand All @@ -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);

Expand Down

0 comments on commit 8988b12

Please sign in to comment.