[asterisk-commits] russell: branch 1.6.2 r290712 - /branches/1.6.2/main/pbx.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Oct 7 05:54:01 CDT 2010


Author: russell
Date: Thu Oct  7 05:53:56 2010
New Revision: 290712

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=290712
Log:
Don't crash when Set() is called without a value.

Review: https://reviewboard.asterisk.org/r/949/

Modified:
    branches/1.6.2/main/pbx.c

Modified: branches/1.6.2/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/main/pbx.c?view=diff&rev=290712&r1=290711&r2=290712
==============================================================================
--- branches/1.6.2/main/pbx.c (original)
+++ branches/1.6.2/main/pbx.c Thu Oct  7 05:53:56 2010
@@ -9111,11 +9111,18 @@
 	mydata = ast_strdupa(data);
 	name = strsep(&mydata, "=");
 	value = mydata;
-	if (strchr(name, ' '))
+	if (!value) {
+		ast_log(LOG_WARNING, "Set requires an '=' to be a valid assignment.\n");
+		return 0;
+	}
+
+	if (strchr(name, ' ')) {
 		ast_log(LOG_WARNING, "Please avoid unnecessary spaces on variables as it may lead to unexpected results ('%s' set to '%s').\n", name, mydata);
+	}
 
 	pbx_builtin_setvar_helper(chan, name, value);
-	return(0);
+
+	return 0;
 }
 
 int pbx_builtin_setvar_multiple(struct ast_channel *chan, void *vdata)




More information about the asterisk-commits mailing list