[svn-commits] murf: trunk r89186 - in /trunk: apps/ cdr/ funcs/ main/ pbx/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Nov 12 12:44:37 CST 2007


Author: murf
Date: Mon Nov 12 12:44:36 2007
New Revision: 89186

URL: http://svn.digium.com/view/asterisk?view=rev&rev=89186
Log:
Based on a note in asterisk-dev by Brian Capouch, I determined I too agressive in not initializing arrays passed to pbx_substitute_variables_xxxx; I reviewed the code (again) and hopefully found every possible spot where substitute_variables is called conditionally, and made sure the char array involved was set to a null string.

Modified:
    trunk/apps/app_exec.c
    trunk/apps/app_mixmonitor.c
    trunk/apps/app_queue.c
    trunk/cdr/cdr_manager.c
    trunk/funcs/func_logic.c
    trunk/main/pbx.c
    trunk/pbx/pbx_dundi.c
    trunk/pbx/pbx_realtime.c

Modified: trunk/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_exec.c?view=diff&rev=89186&r1=89185&r2=89186
==============================================================================
--- trunk/apps/app_exec.c (original)
+++ trunk/apps/app_exec.c Mon Nov 12 12:44:36 2007
@@ -99,6 +99,7 @@
 		return 0;
 	
 	s = ast_strdupa(data);
+	args[0] = 0;
 	appname = strsep(&s, "(");
 	if (s) {
 		endargs = strrchr(s, ')');
@@ -129,6 +130,7 @@
 		return 0;
 
 	s = ast_strdupa(data);
+	args[0] = 0;
 	appname = strsep(&s, "(");
 	if (s) {
 		endargs = strrchr(s, ')');

Modified: trunk/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_mixmonitor.c?view=diff&rev=89186&r1=89185&r2=89186
==============================================================================
--- trunk/apps/app_mixmonitor.c (original)
+++ trunk/apps/app_mixmonitor.c Mon Nov 12 12:44:36 2007
@@ -225,6 +225,7 @@
 
 	len = sizeof(*mixmonitor) + strlen(chan->name) + strlen(filename) + 2;
 
+	postprocess2[0] = 0;
 	/* If a post process system command is given attach it to the structure */
 	if (!ast_strlen_zero(post_process)) {
 		char *p1, *p2;

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?view=diff&rev=89186&r1=89185&r2=89186
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Mon Nov 12 12:44:36 2007
@@ -2703,6 +2703,8 @@
 	struct ao2_iterator memi;
 
 	memset(&bridge_config, 0, sizeof(bridge_config));
+	tmpid[0] = 0;
+	meid[0] = 0;
 	time(&now);
 		
 	for (; options && *options; options++)

Modified: trunk/cdr/cdr_manager.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_manager.c?view=diff&rev=89186&r1=89185&r2=89186
==============================================================================
--- trunk/cdr/cdr_manager.c (original)
+++ trunk/cdr/cdr_manager.c Mon Nov 12 12:44:36 2007
@@ -142,6 +142,7 @@
 	ast_localtime(&cdr->end, &timeresult, NULL);
 	ast_strftime(strEndTime, sizeof(strEndTime), DATE_FORMAT, &timeresult);
 
+	buf[0] = 0;
 	/* Custom fields handling */
 	if (customfields != NULL && customfields->used > 0) {
 		memset(&dummy, 0, sizeof(dummy));

Modified: trunk/funcs/func_logic.c
URL: http://svn.digium.com/view/asterisk/trunk/funcs/func_logic.c?view=diff&rev=89186&r1=89185&r2=89186
==============================================================================
--- trunk/funcs/func_logic.c (original)
+++ trunk/funcs/func_logic.c Mon Nov 12 12:44:36 2007
@@ -157,7 +157,7 @@
 		AST_APP_ARG(varname);
 	);
 	AST_STANDARD_APP_ARGS(args, data);
-
+	buf[0] = 0;
 	if (!ast_strlen_zero(args.varname)) {
 		struct ast_channel *chan2 = ast_get_channel_by_name_locked(args.channel);
 		if (chan2) {

Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=89186&r1=89185&r2=89186
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Mon Nov 12 12:44:36 2007
@@ -1652,6 +1652,7 @@
 			continue;
 		}
 		/* Substitute variables now */
+		
 		if (sw->eval)
 			pbx_substitute_variables_helper(chan, sw->data, sw->tmpdata, SWITCH_DATA_LENGTH - 1);
 
@@ -6886,7 +6887,7 @@
 		ast_log(LOG_WARNING, "Ignoring, since there is no variable to set\n");
 		return 0;
 	}
-
+	tmp[0] = 0;
 	if (!deprecation_warning) {
 		ast_log(LOG_WARNING, "ImportVar is deprecated.  Please use Set(varname=${IMPORT(channel,variable)}) instead.\n");
 		deprecation_warning = 1;

Modified: trunk/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_dundi.c?view=diff&rev=89186&r1=89185&r2=89186
==============================================================================
--- trunk/pbx/pbx_dundi.c (original)
+++ trunk/pbx/pbx_dundi.c Mon Nov 12 12:44:36 2007
@@ -535,6 +535,7 @@
 {
 	char buf[32];
 
+	buf[0] = 0;
 	if (map->weightstr) {
 		pbx_substitute_variables_helper(NULL, map->weightstr, buf, sizeof(buf) - 1);
 		if (sscanf(buf, "%d", &map->_weight) != 1)

Modified: trunk/pbx/pbx_realtime.c
URL: http://svn.digium.com/view/asterisk/trunk/pbx/pbx_realtime.c?view=diff&rev=89186&r1=89185&r2=89186
==============================================================================
--- trunk/pbx/pbx_realtime.c (original)
+++ trunk/pbx/pbx_realtime.c Mon Nov 12 12:44:36 2007
@@ -196,6 +196,7 @@
 				char tmp2[80];
 				char tmp3[EXT_DATA_SIZE];
 
+				appdata[0] = 0; /* just in case the substitute var func isn't called */
 				if(!ast_strlen_zero(tmp))
 					pbx_substitute_variables_helper(chan, tmp, appdata, sizeof(appdata) - 1);
 				ast_verb(3, "Executing %s(\"%s\", \"%s\")\n",




More information about the svn-commits mailing list