Skip to content

Commit

Permalink
[tm] fix accessing free'd reference to script route
Browse files Browse the repository at this point in the history
When setting the T->failure reference to NULL, the previously set script reference is automatically free'ed, so be sure you do not use if afterwards.
Closes #3115
Credits to @Integration-IT for helping with the troubleshooting and testing
  • Loading branch information
bogdan-iancu committed Jul 13, 2023
1 parent 69a5739 commit 30f6c2a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/tm/t_reply.c
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ static inline int run_failure_handlers(struct cell *t)
static struct sip_msg faked_req;
struct sip_msg *shmem_msg;
struct ua_client *uac;
struct script_route_ref *on_failure;
int on_failure_idx;
int old_route_type;

shmem_msg = t->uas.request;
Expand Down Expand Up @@ -622,11 +622,11 @@ static inline int run_failure_handlers(struct cell *t)
/* avoid recursion -- if failure_route forwards, and does not
* set next failure route, failure_route will not be reentered
* on failure */
on_failure = t->on_negative;
on_failure_idx = t->on_negative->idx;
t_on_negative(NULL);
/* run a reply_route action if some was marked */
swap_route_type(old_route_type, FAILURE_ROUTE);
run_top_route(sroutes->failure[on_failure->idx], &faked_req);
run_top_route(sroutes->failure[on_failure_idx], &faked_req);
set_route_type(old_route_type);
}

Expand Down

0 comments on commit 30f6c2a

Please sign in to comment.