From 70c981364fc086fc8daa4cba6e18e1e29c394436 Mon Sep 17 00:00:00 2001 From: Nanang Izzuddin Date: Fri, 23 Oct 2015 09:50:16 +0000 Subject: 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 --- pjsip/src/pjsip/sip_msg.c | 24 ++++++++++++++---------- 1 file 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 */ -- cgit v1.2.3