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 <[EMAIL PROTECTED]>
 
+       * 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 <[EMAIL PROTECTED]>

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;
 }

_______________________________________________
Asterisk-Cvs mailing list
[email protected]
http://lists.digium.com/mailman/listinfo/asterisk-cvs

Reply via email to