From: Anthony Minessale Date: Mon, 22 Oct 2007 14:30:21 +0000 (+0000) Subject: avoiding segfault X-Git-Tag: v1.0-beta2~352 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=603463d12637da1881e333251f7788717ea0f5fe;p=thirdparty%2Ffreeswitch.git avoiding segfault git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6016 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index d255947fbe..7347f20a04 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -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) {