diff options
author | Benny Prijono <bennylp@teluu.com> | 2010-08-31 16:46:13 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2010-08-31 16:46:13 +0000 |
commit | 6e505d0f4b8b721da3c37f91e296a2a15bd74fb6 (patch) | |
tree | d1399c919d1f4fb58564a2e795729444e278246a | |
parent | 27fb3d3cd5103ea814d6c62f802aef9f1292ddc6 (diff) |
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
-rw-r--r-- | pjsip/src/pjsip/sip_msg.c | 7 |
1 files 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 <pj/string.h> #include <pj/pool.h> #include <pj/assert.h> +#include <pjlib-util/string.h> 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, |