Skip to content

Commit

Permalink
consider string size in hex2dec transformation
Browse files Browse the repository at this point in the history
Reported by gergelypeli on GitHub
Closes #296

(cherry picked from commit 9b79b1b)
  • Loading branch information
razvancrainea committed Aug 12, 2014
1 parent 3316071 commit b7dd3b7
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions transformations.c
Expand Up @@ -189,9 +189,7 @@ int tr_eval_string(struct sip_msg *msg, tr_param_t *tp, int subtype,
if(val->flags&PV_VAL_INT)
break; /* already converted */
s = NULL;
errno = 0;
i = strtol(val->rs.s, &s, 16);
if (!s || *s || errno == ERANGE)
if (hexstr2int(val->rs.s, val->rs.len, (unsigned int *)&i) < 0)
return -1;
val->rs.s = int2str(i, &val->rs.len);
val->ri = i;
Expand Down

0 comments on commit b7dd3b7

Please sign in to comment.