summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2015-10-23 09:50:16 +0000
committerNanang Izzuddin <nanang@teluu.com>2015-10-23 09:50:16 +0000
commit70c981364fc086fc8daa4cba6e18e1e29c394436 (patch)
tree5baf6485218bee9b6ac0ae2736cb64066dbf0e4c
parente0749cce2d663cb5f817c244170d1bf69526f14a (diff)
Misc (re #1882): Only check 'hide' URI parameter on SIP/SIPS URIs in printing route header, otherwise it may cause crash as other URI types may not have 'other_param' field (thanks thanks Fredrik Hansson for the patch).
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5191 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjsip/src/pjsip/sip_msg.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/pjsip/src/pjsip/sip_msg.c b/pjsip/src/pjsip/sip_msg.c
index eca20f65..e888c922 100644
--- a/pjsip/src/pjsip/sip_msg.c
+++ b/pjsip/src/pjsip/sip_msg.c
@@ -1702,17 +1702,21 @@ static int pjsip_routing_hdr_print( pjsip_routing_hdr *hdr,
/* Check the proprietary param 'hide', don't print this header
* if it exists in the route URI.
*/
- sip_uri = (pjsip_sip_uri*) pjsip_uri_get_uri(hdr->name_addr.uri);
- p = sip_uri->other_param.next;
- while (p != &sip_uri->other_param) {
- const pj_str_t st_hide = {"hide", 4};
-
- if (pj_stricmp(&p->name, &st_hide) == 0) {
- /* Check if param 'hide' is specified without 'lr'. */
- pj_assert(sip_uri->lr_param != 0);
- return 0;
+ if (PJSIP_URI_SCHEME_IS_SIPS(hdr->name_addr.uri) ||
+ PJSIP_URI_SCHEME_IS_SIP(hdr->name_addr.uri))
+ {
+ sip_uri = (pjsip_sip_uri*) pjsip_uri_get_uri(hdr->name_addr.uri);
+ p = sip_uri->other_param.next;
+ while (p != &sip_uri->other_param) {
+ const pj_str_t st_hide = {"hide", 4};
+
+ if (pj_stricmp(&p->name, &st_hide) == 0) {
+ /* Check if param 'hide' is specified without 'lr'. */
+ pj_assert(sip_uri->lr_param != 0);
+ return 0;
+ }
+ p = p->next;
}
- p = p->next;
}
/* Route and Record-Route don't compact forms */