Skip to content

Commit

Permalink
params: initialize expanded parameters
Browse files Browse the repository at this point in the history
Also, do not indicate that an INT also has a STR value if it doesn't,
because other functions might try to evaluate it; and combined with the
lack of initialization, it might end up reading whatever leftovers are
in the `.rs` field, posibly leading to a crash.

Many thanks to Nick Altmann for reporting this and Liviu Chircu for
testing and support :)

(cherry picked from commit 16f5212)
  • Loading branch information
razvancrainea committed Mar 28, 2023
1 parent d94c892 commit 712db28
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion action.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,7 @@ static pv_value_t *route_params_expand(struct sip_msg *msg,
LM_ERR("oom\n");
return NULL;
}
memset(route_vals, 0, params_no * sizeof(*route_vals));

for (index = 0; index < params_no; index++) {
res = &route_vals[index];
Expand All @@ -468,7 +469,7 @@ static pv_value_t *route_params_expand(struct sip_msg *msg,

case NUMBER_ST:
res->ri = actions[index].u.number;
res->flags = PV_VAL_STR|PV_VAL_INT|PV_TYPE_INT;
res->flags = PV_VAL_INT|PV_TYPE_INT;
break;

case SCRIPTVAR_ST:
Expand Down

0 comments on commit 712db28

Please sign in to comment.