avoiding segfault

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6016 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-10-22 14:30:21 +00:00
parent b6c408a9e3
commit 603463d126
1 changed files with 9 additions and 1 deletions

View 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 { \ #define check_decode(_var, _session) do { \
assert(_session); \ assert(_session); \
if (strchr(_var, '%')) { \ if (!switch_strlen_zero(_var) && strchr(_var, '%')) { \
char *tmp = switch_core_session_strdup(_session, _var); \ char *tmp = switch_core_session_strdup(_session, _var); \
switch_url_decode(tmp); \ switch_url_decode(tmp); \
_var = 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; port = url->url_port;
} }
if (switch_strlen_zero(user)) {
user = "nobody";
}
if (switch_strlen_zero(host)) {
host = "nowhere";
}
check_decode(user, session); check_decode(user, session);
if (user) { if (user) {