[Freeswitch-svn] [commit] r6016 - freeswitch/trunk/src/mod/endpoints/mod_sofia

Freeswitch SVN anthm at freeswitch.org
Mon Oct 22 10:30:22 EDT 2007


Author: anthm
Date: Mon Oct 22 10:30:21 2007
New Revision: 6016

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c

Log:
avoiding segfault

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Mon Oct 22 10:30:21 2007
@@ -1774,7 +1774,7 @@
 
 #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 @@
 		port = url->url_port;
 	}
 
+	if (switch_strlen_zero(user)) {
+		user = "nobody";
+	}
+
+	if (switch_strlen_zero(host)) {
+		host = "nowhere";
+	}
+
 	check_decode(user, session);
 
 	if (user) {



More information about the Freeswitch-svn mailing list