[Asterisk-cvs] asterisk ChangeLog, 1.123, 1.124 manager.c, 1.135, 1.136

russell russell
Tue Nov 15 13:45:27 CST 2005


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv27596

Modified Files:
	ChangeLog manager.c 
Log Message:
don't crash on setvar (issue #5760)


Index: ChangeLog
===================================================================
RCS file: /usr/cvsroot/asterisk/ChangeLog,v
retrieving revision 1.123
retrieving revision 1.124
diff -u -d -r1.123 -r1.124
--- ChangeLog	15 Nov 2005 18:16:46 -0000	1.123
+++ ChangeLog	15 Nov 2005 18:35:30 -0000	1.124
@@ -1,5 +1,7 @@
 2005-11-15  Russell Bryant <russell at digium.com>
 
+	* manager.c: Don't crash on a SetVar action if the channel name is not set, or variable's value is not set (issue #5760)
+
 	* doc/README.variables: Add application exit status variables
 
 2005-11-14  Josh Roberson <josh at asteirasgi.com>

Index: manager.c
===================================================================
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- manager.c	15 Nov 2005 01:33:31 -0000	1.135
+++ manager.c	15 Nov 2005 18:35:30 -0000	1.136
@@ -689,6 +689,11 @@
 		astman_send_error(s, m, "No variable specified");
 		return 0;
 	}
+	
+	if (ast_strlen_zero(varval)) {
+		astman_send_error(s, m, "No value specified");
+		return 0;
+	}
 
 	if (!ast_strlen_zero(name)) {
 		c = ast_get_channel_by_name_locked(name);
@@ -698,10 +703,12 @@
 		}
 	}
 	
-	pbx_builtin_setvar_helper(c,varname,varval);
+	pbx_builtin_setvar_helper(c, varname, varval);
 	  
-	ast_mutex_unlock(&c->lock);
-	astman_send_ack(s, m, "Variable Set");
+	if (c)
+		ast_mutex_unlock(&c->lock);
+
+	astman_send_ack(s, m, "Variable Set");	
 
 	return 0;
 }




More information about the svn-commits mailing list