[Freeswitch-svn] [commit] r8480 - freeswitch/trunk/src/mod/applications/mod_dptools

Freeswitch SVN mikej at freeswitch.org
Mon May 19 18:17:10 EDT 2008


Author: mikej
Date: Mon May 19 18:17:10 2008
New Revision: 8480

Modified:
   freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c

Log:
don't deref NULL. Found by Klockwork (www.klocwork.com)

Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	Mon May 19 18:17:10 2008
@@ -804,7 +804,15 @@
 	} else {
 		exports = switch_channel_get_variable(channel, SWITCH_EXPORT_VARS_VARIABLE);
 		var = switch_core_session_strdup(session, data);
-		val = strchr(var, '=');
+		if (var) {
+			val = strchr(var, '=');
+			if (!strncasecmp(var, "nolocal:", 8)) {
+				var_name = var + 8;
+				local = 0;
+			} else {
+				var_name = var;
+			}
+		}
 
 		if (val) {
 			*val++ = '\0';
@@ -813,14 +821,7 @@
 			}
 		}
 
-		if (!strncasecmp(var, "nolocal:", 8)) {
-			var_name = var + 8;
-			local = 0;
-		} else {
-			var_name = var;
-		}
-
-		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXPORT %s[%s]=[%s]\n", local ? "" : "(REMOTE ONLY) ", var_name, val ? val : "UNDEF");
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "EXPORT %s[%s]=[%s]\n", local ? "" : "(REMOTE ONLY) ", var_name ? var_name : "", val ? val : "UNDEF");
 		switch_channel_set_variable(channel, var, val);
 
 		if (var && val) {



More information about the Freeswitch-svn mailing list