]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
fix seg in some edge cases
authorMichael Jerris <mike@jerris.com>
Tue, 16 Jun 2009 13:41:01 +0000 (13:41 +0000)
committerMichael Jerris <mike@jerris.com>
Tue, 16 Jun 2009 13:41:01 +0000 (13:41 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13781 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia_glue.c
src/switch_utils.c

index 3cdd9b3628931ec8c291381ebbd66c0e7080d1ab..4497547d5e3a414ec7b2a1e123a32c4c54b0bc06 100644 (file)
@@ -1662,7 +1662,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                sofia_glue_tech_patch_sdp(tech_pvt);
        }
 
-       if (tech_pvt->dest && (route = strstr(tech_pvt->dest, ";fs_path="))) {
+       if (tech_pvt->dest && (route = strstr(tech_pvt->dest, ";fs_path=")) && (*(route + 9))) {
                char *p;
 
                route = switch_core_session_strdup(tech_pvt->session, route + 9);
@@ -1686,6 +1686,8 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                }
                
                route_uri = sofia_overcome_sip_uri_weakness(tech_pvt->session, route_uri, 0, SWITCH_TRUE, NULL);
+       } else {
+               route = NULL;
        }
 
        if ((val = switch_channel_get_variable(channel, "sip_route_uri"))) {
@@ -1715,7 +1717,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                           TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
                           TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)),
                           TAG_IF(tech_pvt->route_uri, NUTAG_PROXY(tech_pvt->route_uri)),
-                          TAG_IF(route, SIPTAG_ROUTE_STR(route)),
+                          TAG_IF(!switch_strlen_zero(route), SIPTAG_ROUTE_STR(route)),
                           TAG_IF(!switch_strlen_zero(sendto), NUTAG_PROXY(sendto)),
                           SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
                           SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
index de1bf0f87fef3544a42a70e43f5388318cf97a3e..9073796b2d6bb24b96ea099900f856f0dd19b0aa 100644 (file)
@@ -1688,6 +1688,10 @@ SWITCH_DECLARE(char *) switch_url_decode(char *s)
        char *o;
        unsigned int tmp;
 
+       if (switch_strlen_zero(s)) {
+               return s;
+       }
+
        for (o = s; *s; s++, o++) {
                if (*s == '%' && strlen(s) > 2 && sscanf(s + 1, "%2x", &tmp) == 1) {
                        *o = (char) tmp;