From 6e505d0f4b8b721da3c37f91e296a2a15bd74fb6 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Tue, 31 Aug 2010 16:46:13 +0000 Subject: Fixed #1116 (Bug in regenerating elements of some headers when incoming request contains escaped characters (thanks Ferguen Adel for the report)): - Fixed the printing part of Via "branch" parameter and To/From "tag" parameter, since these parameters are important for transaction/dialog identification - Note that if the escaping sequence describes a character that otherwise is a valid token, that token would still be printed unescaped, hence the problem would still persist. But sender really shouldn't send this kind of escaped sequence as it really is asking for trouble. git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3301 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip/src/pjsip/sip_msg.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pjsip/src/pjsip/sip_msg.c b/pjsip/src/pjsip/sip_msg.c index 4c6b376c..1b38c240 100644 --- a/pjsip/src/pjsip/sip_msg.c +++ b/pjsip/src/pjsip/sip_msg.c @@ -26,6 +26,7 @@ #include #include #include +#include PJ_DEF_DATA(const pjsip_method) pjsip_invite_method = { PJSIP_INVITE_METHOD, { "INVITE",6 }}; @@ -1524,7 +1525,8 @@ static int pjsip_fromto_hdr_print( pjsip_fromto_hdr *hdr, buf += printed; - copy_advance_pair(buf, ";tag=", 5, hdr->tag); + copy_advance_pair_escape(buf, ";tag=", 5, hdr->tag, + pc->pjsip_TOKEN_SPEC); printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, &pc->pjsip_TOKEN_SPEC, @@ -2049,7 +2051,8 @@ static int pjsip_via_hdr_print( pjsip_via_hdr *hdr, } copy_advance_pair(buf, ";received=", 10, hdr->recvd_param); - copy_advance_pair(buf, ";branch=", 8, hdr->branch_param); + copy_advance_pair_escape(buf, ";branch=", 8, hdr->branch_param, + pc->pjsip_TOKEN_SPEC); printed = pjsip_param_print_on(&hdr->other_param, buf, endbuf-buf, &pc->pjsip_TOKEN_SPEC, -- cgit v1.2.3