Skip to content

Commit

Permalink
pv: handle s.prefixes for empty values
Browse files Browse the repository at this point in the history
- avoid crash due to invalid length of result, GH #2467

(cherry picked from commit e74b06c)
  • Loading branch information
miconda committed Sep 4, 2020
1 parent 0f6dea7 commit ad14b61
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/pv/pv_trans.c
Expand Up @@ -909,6 +909,7 @@ int tr_eval_string(struct sip_msg *msg, tr_param_t *tp, int subtype,
if(!(val->flags&PV_VAL_STR))
val->rs.s = int2str(val->ri, &val->rs.len);


/* Set maximum prefix length */
max = val->rs.len;
if(tp!=NULL) {
Expand Down Expand Up @@ -947,7 +948,7 @@ int tr_eval_string(struct sip_msg *msg, tr_param_t *tp, int subtype,
memset(val, 0, sizeof(pv_value_t));
val->flags = PV_VAL_STR;
val->rs.s = _tr_buffer;
val->rs.len = j-1;
val->rs.len = (j>0)?(j-1):0;
break;


Expand Down

0 comments on commit ad14b61

Please sign in to comment.