Module: kamailio Branch: master Commit: 5bc9394024690e6d931b141d708ecd2815be40ce URL: https://github.com/kamailio/kamailio/commit/5bc9394024690e6d931b141d708ecd28...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2016-09-06T12:51:45+02:00
topos: trim values before reinserting the route header
---
Modified: modules/topos/tps_msg.c
---
Diff: https://github.com/kamailio/kamailio/commit/5bc9394024690e6d931b141d708ecd28... Patch: https://github.com/kamailio/kamailio/commit/5bc9394024690e6d931b141d708ecd28...
---
diff --git a/modules/topos/tps_msg.c b/modules/topos/tps_msg.c index 4757c0b..acca572 100644 --- a/modules/topos/tps_msg.c +++ b/modules/topos/tps_msg.c @@ -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) { @@ -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; }