Skip to content

Commit

Permalink
topos: trim values before reinserting the route header
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Sep 6, 2016
1 parent fe1fdba commit 5bc9394
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/topos/tps_msg.c
Expand Up @@ -637,7 +637,7 @@ int tps_reappend_route(sip_msg_t *msg, tps_data_t *ptsd, str *hbody, int rev)
int c;
str sb;

if(hbody==NULL || hbody->s==NULL || hbody->len<=0)
if(hbody==NULL || hbody->s==NULL || hbody->len<=0 || hbody->s[0]=='\0')
return 0;

if(rev==1) {
Expand Down Expand Up @@ -670,7 +670,10 @@ int tps_reappend_route(sip_msg_t *msg, tps_data_t *ptsd, str *hbody, int rev)
}

sb = *hbody;
if(sb.s[sb.len-1]==',') sb.len--;
if(sb.len>0 && sb.s[sb.len-1]==',') sb.len--;
trim_zeros_lr(&sb);
trim(&sb);
if(sb.len>0 && sb.s[sb.len-1]==',') sb.len--;
if(tps_add_headers(msg, &hname, &sb, 0)<0) {
return -1;
}
Expand Down

0 comments on commit 5bc9394

Please sign in to comment.