]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
avoiding segfault
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 22 Oct 2007 14:30:21 +0000 (14:30 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 22 Oct 2007 14:30:21 +0000 (14:30 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6016 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/sofia.c

index d255947fbe5f8879bbc7abd3bb5741026dab0683..7347f20a043981b695279ac4fb804966b2e5dbc4 100644 (file)
@@ -1774,7 +1774,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
 
 #define check_decode(_var, _session) do {                                                              \
                assert(_session);                                                                                               \
-               if (strchr(_var, '%')) {                                                                                \
+               if (!switch_strlen_zero(_var) && strchr(_var, '%')) {                   \
                        char *tmp = switch_core_session_strdup(_session, _var);         \
                        switch_url_decode(tmp);                                                                         \
                        _var = tmp;                                                                                                     \
@@ -1797,6 +1797,14 @@ const char *_url_set_chanvars(switch_core_session_t *session, url_t *url, const
                port = url->url_port;
        }
 
+       if (switch_strlen_zero(user)) {
+               user = "nobody";
+       }
+
+       if (switch_strlen_zero(host)) {
+               host = "nowhere";
+       }
+
        check_decode(user, session);
 
        if (user) {