Skip to content

Commit

Permalink
topoh: detect when via param is shorter than expected prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Mar 4, 2019
1 parent cbadbca commit e6950ff
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/modules/topoh/th_msg.c
Expand Up @@ -418,12 +418,17 @@ int th_unmask_via(sip_msg_t *msg, str *cookie)
LM_ERR("cannot find param in via %d\n", i);
return -1;
}
if(i==2)
if(vp->value.len <= th_vparam_prefix.len) {
LM_ERR("invalid param len in via %d\n", i);
return -1;
}
if(i==2) {
out.s = th_mask_decode(vp->value.s, vp->value.len,
&th_vparam_prefix, CRLF_LEN+1, &out.len);
else
} else {
out.s = th_mask_decode(vp->value.s, vp->value.len,
&th_vparam_prefix, 0, &out.len);
}
if(out.s==NULL || out.len<=0)
{
LM_ERR("cannot decode via %d\n", i);
Expand Down

0 comments on commit e6950ff

Please sign in to comment.