From 65336276f219454210556b36f3d37a0e957d9c1c Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Fri, 5 Aug 2016 08:27:41 +0200 Subject: [PATCH] topos: skip comma at the end when reinserting rr headers - reported by GH #716 --- modules/topos/tps_msg.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/topos/tps_msg.c b/modules/topos/tps_msg.c index 2f398e8092c..ecc67ef69c4 100644 --- a/modules/topos/tps_msg.c +++ b/modules/topos/tps_msg.c @@ -629,6 +629,7 @@ int tps_reappend_route(sip_msg_t *msg, tps_data_t *ptsd, str *hbody, int rev) c = 1; if(sb.len>0) { sb.s = hbody->s + i + 1; + if(sb.s[sb.len-1]==',') sb.len--; if(tps_add_headers(msg, &hname, &sb, 0)<0) { return -1; } @@ -640,6 +641,7 @@ int tps_reappend_route(sip_msg_t *msg, tps_data_t *ptsd, str *hbody, int rev) if(c==1) { if(sb.len>0) { sb.s = hbody->s; + if(sb.s[sb.len-1]==',') sb.len--; if(tps_add_headers(msg, &hname, &sb, 0)<0) { return -1; } @@ -648,7 +650,9 @@ int tps_reappend_route(sip_msg_t *msg, tps_data_t *ptsd, str *hbody, int rev) } } - if(tps_add_headers(msg, &hname, hbody, 0)<0) { + sb = *hbody; + if(sb.s[sb.len-1]==',') sb.len--; + if(tps_add_headers(msg, &hname, &sb, 0)<0) { return -1; }