[asterisk-commits] trunk - r8387 in /trunk: apps/ channels/ funcs/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Jan 21 10:50:17 MST 2006


Author: russell
Date: Sat Jan 21 11:50:04 2006
New Revision: 8387

URL: http://svn.digium.com/view/asterisk?rev=8387&view=rev
Log:
revert my pass through the tree to remove checks of the result of ast_strdupa
(revisions 8378 through 8381)

Modified:
    trunk/apps/app_authenticate.c
    trunk/apps/app_chanspy.c
    trunk/apps/app_curl.c
    trunk/apps/app_db.c
    trunk/apps/app_dial.c
    trunk/apps/app_dictate.c
    trunk/apps/app_directory.c
    trunk/apps/app_disa.c
    trunk/apps/app_exec.c
    trunk/apps/app_externalivr.c
    trunk/apps/app_festival.c
    trunk/apps/app_hasnewvoicemail.c
    trunk/apps/app_image.c
    trunk/apps/app_macro.c
    trunk/apps/app_meetme.c
    trunk/apps/app_mixmonitor.c
    trunk/apps/app_osplookup.c
    trunk/apps/app_page.c
    trunk/apps/app_playback.c
    trunk/apps/app_privacy.c
    trunk/apps/app_queue.c
    trunk/apps/app_random.c
    trunk/apps/app_read.c
    trunk/apps/app_readfile.c
    trunk/apps/app_realtime.c
    trunk/apps/app_record.c
    trunk/apps/app_sayunixtime.c
    trunk/apps/app_senddtmf.c
    trunk/apps/app_sendtext.c
    trunk/apps/app_setcallerid.c
    trunk/apps/app_skel.c
    trunk/apps/app_stack.c
    trunk/apps/app_talkdetect.c
    trunk/apps/app_transfer.c
    trunk/apps/app_url.c
    trunk/apps/app_userevent.c
    trunk/apps/app_verbose.c
    trunk/apps/app_voicemail.c
    trunk/apps/app_while.c
    trunk/apps/app_zapras.c
    trunk/channels/chan_agent.c
    trunk/channels/chan_iax2.c
    trunk/channels/chan_sip.c
    trunk/funcs/func_cdr.c
    trunk/funcs/func_cut.c
    trunk/funcs/func_logic.c
    trunk/funcs/func_math.c
    trunk/funcs/func_md5.c
    trunk/funcs/func_odbc.c
    trunk/funcs/func_rand.c
    trunk/funcs/func_strings.c

Modified: trunk/apps/app_authenticate.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_authenticate.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_authenticate.c (original)
+++ trunk/apps/app_authenticate.c Sat Jan 21 11:50:04 2006
@@ -129,6 +129,11 @@
 	}
 	
 	argcopy = ast_strdupa(data);
+	if (!argcopy) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(arglist,argcopy);
 	

Modified: trunk/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_chanspy.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_chanspy.c (original)
+++ trunk/apps/app_chanspy.c Sat Jan 21 11:50:04 2006
@@ -383,7 +383,10 @@
 	struct ast_flags flags;
 	signed char zero_volume = 0;
 
-	args = ast_strdupa(data);
+	if (!(args = ast_strdupa((char *)data))) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		return -1;
+	}
 
 	LOCAL_USER_ADD(u);
 

Modified: trunk/apps/app_curl.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_curl.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_curl.c (original)
+++ trunk/apps/app_curl.c Sat Jan 21 11:50:04 2006
@@ -129,6 +129,11 @@
 	LOCAL_USER_ACF_ADD(u);
 
 	info = ast_strdupa(data);
+	if (!info) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		LOCAL_USER_REMOVE(u);
+		return buf;
+	}
 
 	AST_STANDARD_APP_ARGS(args, info);	
 	

Modified: trunk/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_db.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_db.c (original)
+++ trunk/apps/app_db.c Sat Jan 21 11:50:04 2006
@@ -76,6 +76,11 @@
 	LOCAL_USER_ADD(u);
 
 	argv = ast_strdupa(data);
+	if (!argv) {
+		ast_log(LOG_ERROR, "Memory allocation failed\n");
+		LOCAL_USER_REMOVE(u);
+		return 0;
+	}
 
 	if (strchr(argv, '/')) {
 		family = strsep(&argv, "/");
@@ -117,6 +122,11 @@
 	LOCAL_USER_ADD(u);
 
 	argv = ast_strdupa(data);
+	if (!argv) {
+		ast_log (LOG_ERROR, "Memory allocation failed\n");
+		LOCAL_USER_REMOVE(u);
+		return 0;
+	}
 
 	if (strchr(argv, '/')) {
 		family = strsep(&argv, "/");

Modified: trunk/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dial.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Sat Jan 21 11:50:04 2006
@@ -786,7 +786,11 @@
 
 	LOCAL_USER_ADD(u);
 
-	parse = ast_strdupa(data);
+	if (!(parse = ast_strdupa(data))) {
+		ast_log(LOG_WARNING, "Memory allocation failure\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 	
 	AST_STANDARD_APP_ARGS(args, parse);
 
@@ -1624,6 +1628,11 @@
 	LOCAL_USER_ADD(u);
 
 	announce = ast_strdupa(data);	
+	if (!announce) {	
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 	
 	memset(&peerflags, 0, sizeof(peerflags));
 

Modified: trunk/apps/app_dictate.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_dictate.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_dictate.c (original)
+++ trunk/apps/app_dictate.c Sat Jan 21 11:50:04 2006
@@ -111,6 +111,10 @@
 	snprintf(dftbase, sizeof(dftbase), "%s/dictate", ast_config_AST_SPOOL_DIR);
 	if (!ast_strlen_zero(data)) {
 		parse = ast_strdupa(data);
+		if (!parse) {
+			ast_log(LOG_ERROR, "Out of memory!\n");
+			return -1;
+		}
 		AST_STANDARD_APP_ARGS(args, parse);
 	} else
 		args.argc = 0;

Modified: trunk/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_directory.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_directory.c (original)
+++ trunk/apps/app_directory.c Sat Jan 21 11:50:04 2006
@@ -433,6 +433,12 @@
 
 	parse = ast_strdupa(data);
 
+	if (!parse) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1; 
+	}
+
 	AST_STANDARD_APP_ARGS(args, parse);
 		
 	if (args.options) {

Modified: trunk/apps/app_disa.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_disa.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_disa.c (original)
+++ trunk/apps/app_disa.c Sat Jan 21 11:50:04 2006
@@ -162,6 +162,11 @@
 	ast_log(LOG_DEBUG, "Responsetimeout: %d\n", firstdigittimeout);
 
 	tmp = ast_strdupa(data);
+	if (!tmp) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}	
 
 	AST_STANDARD_APP_ARGS(args, tmp);
 

Modified: trunk/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_exec.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_exec.c (original)
+++ trunk/apps/app_exec.c Sat Jan 21 11:50:04 2006
@@ -73,22 +73,27 @@
 
 	/* Check and parse arguments */
 	if (data) {
-		s = ast_strdupa(data);
-		appname = strsep(&s, "(");
+		s = ast_strdupa((char *)data);
 		if (s) {
-			endargs = strrchr(s, ')');
-			if (endargs)
-				*endargs = '\0';
-			pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
-		}
-		if (appname) {
-			app = pbx_findapp(appname);
-			if (app) {
-				res = pbx_exec(chan, app, args, 1);
-			} else {
-				ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
-				res = -1;
+			appname = strsep(&s, "(");
+			if (s) {
+				endargs = strrchr(s, ')');
+				if (endargs)
+					*endargs = '\0';
+				pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
 			}
+			if (appname) {
+				app = pbx_findapp(appname);
+				if (app) {
+					res = pbx_exec(chan, app, args, 1);
+				} else {
+					ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
+					res = -1;
+				}
+			}
+		} else {
+			ast_log(LOG_ERROR, "Out of memory\n");
+			res = -1;
 		}
 	}
 

Modified: trunk/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_externalivr.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_externalivr.c (original)
+++ trunk/apps/app_externalivr.c Sat Jan 21 11:50:04 2006
@@ -272,6 +272,11 @@
 	}
 
 	buf = ast_strdupa(data);
+	if (!buf) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	argc = ast_app_separate_args(buf, '|', argv, sizeof(argv) / sizeof(argv[0]));
 

Modified: trunk/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_festival.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_festival.c (original)
+++ trunk/apps/app_festival.c Sat Jan 21 11:50:04 2006
@@ -340,6 +340,12 @@
 	}
 	
 	data = ast_strdupa(vdata);
+	if (!data) {
+		ast_log(LOG_ERROR, "Out of memery\n");
+		ast_config_destroy(cfg);
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	intstr = strchr(data, '|');
 	if (intstr) {	

Modified: trunk/apps/app_hasnewvoicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_hasnewvoicemail.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_hasnewvoicemail.c (original)
+++ trunk/apps/app_hasnewvoicemail.c Sat Jan 21 11:50:04 2006
@@ -130,6 +130,11 @@
 	LOCAL_USER_ADD(u);
 
 	input = ast_strdupa((char *)data);
+	if (! input) {
+		ast_log(LOG_ERROR, "Out of memory error\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, input);
 
@@ -189,6 +194,11 @@
 	buf[0] = '\0';
 
 	argsstr = ast_strdupa(data);
+	if (!argsstr) {
+		ast_log(LOG_ERROR, "Out of memory");
+		LOCAL_USER_REMOVE(u);
+		return buf;
+	}
 
 	AST_STANDARD_APP_ARGS(args, argsstr);
 

Modified: trunk/apps/app_image.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_image.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_image.c (original)
+++ trunk/apps/app_image.c Sat Jan 21 11:50:04 2006
@@ -78,7 +78,11 @@
 	
 	LOCAL_USER_ADD(u);
 
-	parse = ast_strdupa(data);
+	if (!(parse = ast_strdupa(data))) {
+		ast_log(LOG_WARNING, "Memory Error!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 

Modified: trunk/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_macro.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_macro.c (original)
+++ trunk/apps/app_macro.c Sat Jan 21 11:50:04 2006
@@ -308,6 +308,11 @@
 	LOCAL_USER_ADD(u);
 
 	expr = ast_strdupa(data);
+	if (!expr) {
+		ast_log(LOG_ERROR, "Out of Memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	if ((label_a = strchr(expr, '?'))) {
 		*label_a = '\0';

Modified: trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_meetme.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_meetme.c (original)
+++ trunk/apps/app_meetme.c Sat Jan 21 11:50:04 2006
@@ -1779,6 +1779,10 @@
 					continue;
 				
 				parse = ast_strdupa(var->value);
+				if (!parse) {
+					ast_log(LOG_ERROR, "Out of Memory!\n");
+					return NULL;
+				}
 				
 				AST_STANDARD_APP_ARGS(args, parse);
 				if (!strcasecmp(args.confno, confno)) {
@@ -1835,6 +1839,11 @@
 	LOCAL_USER_ADD(u);
 	
 	localdata = ast_strdupa(data);
+	if (!localdata) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, localdata);
 	

Modified: trunk/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_mixmonitor.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_mixmonitor.c (original)
+++ trunk/apps/app_mixmonitor.c Sat Jan 21 11:50:04 2006
@@ -333,7 +333,11 @@
 
 	LOCAL_USER_ADD(u);
 
-	parse = ast_strdupa(data);
+	if (!(parse = ast_strdupa(data))) {
+		ast_log(LOG_WARNING, "Memory Error!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 	

Modified: trunk/apps/app_osplookup.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_osplookup.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_osplookup.c (original)
+++ trunk/apps/app_osplookup.c Sat Jan 21 11:50:04 2006
@@ -139,6 +139,11 @@
 	LOCAL_USER_ADD(u);
 
 	temp = ast_strdupa(data);
+	if (!temp) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, temp);
 
@@ -197,6 +202,11 @@
 	LOCAL_USER_ADD(u);
 
 	temp = ast_strdupa(data);
+	if (!temp) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, temp);
 
@@ -266,6 +276,11 @@
 	LOCAL_USER_ADD(u);
 
 	temp = ast_strdupa(data);
+	if (!temp) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, temp);
 

Modified: trunk/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_page.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_page.c (original)
+++ trunk/apps/app_page.c Sat Jan 21 11:50:04 2006
@@ -164,6 +164,11 @@
 	};
 
 	options = ast_strdupa(data);
+	if (!options) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	tmp = strsep(&options, "|");
 	if (options)

Modified: trunk/apps/app_playback.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_playback.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_playback.c (original)
+++ trunk/apps/app_playback.c Sat Jan 21 11:50:04 2006
@@ -90,6 +90,10 @@
 	}
 
 	tmp = ast_strdupa(data);
+	if (!tmp) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		return -1;	
+	}
 
 	LOCAL_USER_ADD(u);
 	AST_STANDARD_APP_ARGS(args, tmp);

Modified: trunk/apps/app_privacy.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_privacy.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_privacy.c (original)
+++ trunk/apps/app_privacy.c Sat Jan 21 11:50:04 2006
@@ -118,6 +118,11 @@
 		if (!ast_strlen_zero((char *)data))
 		{
 			parse = ast_strdupa(data);
+			if (!parse) {
+				ast_log(LOG_ERROR, "Out of memory!\n");
+				LOCAL_USER_REMOVE(u);
+				return -1;
+			}
 			
 			AST_STANDARD_APP_ARGS(args, parse);
 

Modified: trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_queue.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_queue.c (original)
+++ trunk/apps/app_queue.c Sat Jan 21 11:50:04 2006
@@ -2645,7 +2645,11 @@
 
 	LOCAL_USER_ADD(u);
 
-	parse = ast_strdupa(data);
+	if (!(parse = ast_strdupa(data))) {
+		ast_log(LOG_WARNING, "Memory Error!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 
@@ -2697,7 +2701,11 @@
 
 	LOCAL_USER_ADD(u);
 
-	parse = ast_strdupa(data);
+	if (!(parse = ast_strdupa(data))) {
+		ast_log(LOG_WARNING, "Memory Error!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;	
+	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 
@@ -2751,7 +2759,11 @@
 
 	LOCAL_USER_ADD(u);
 
-	parse = ast_strdupa(data);
+	if (!(parse = ast_strdupa(data))) {
+		ast_log(LOG_WARNING, "Memory Error!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 
@@ -2815,11 +2827,7 @@
 
 	LOCAL_USER_ADD(u);
 
-	if (!(parse = ast_strdupa(data))) {
-		ast_log(LOG_WARNING, "Memory Error!\n");
-		LOCAL_USER_REMOVE(u);
-		return -1;
-	}
+	parse = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, parse);
 

Modified: trunk/apps/app_random.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_random.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_random.c (original)
+++ trunk/apps/app_random.c Sat Jan 21 11:50:04 2006
@@ -74,6 +74,11 @@
 	LOCAL_USER_ADD(u);
 
 	s = ast_strdupa(data);
+	if (!s) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	prob = strsep(&s,":");
 	if ((!prob) || (sscanf(prob, "%d", &probint) != 1))

Modified: trunk/apps/app_read.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_read.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_read.c (original)
+++ trunk/apps/app_read.c Sat Jan 21 11:50:04 2006
@@ -118,6 +118,11 @@
 	LOCAL_USER_ADD(u);
 	
 	argcopy = ast_strdupa(data);
+	if (!argcopy) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(arglist, argcopy);
 

Modified: trunk/apps/app_readfile.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_readfile.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_readfile.c (original)
+++ trunk/apps/app_readfile.c Sat Jan 21 11:50:04 2006
@@ -74,6 +74,11 @@
 	LOCAL_USER_ADD(u);
 
 	s = ast_strdupa(data);
+	if (!s) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	varname = strsep(&s, "=");
 	file = strsep(&s, "|");

Modified: trunk/apps/app_realtime.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_realtime.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_realtime.c (original)
+++ trunk/apps/app_realtime.c Sat Jan 21 11:50:04 2006
@@ -148,19 +148,20 @@
 	
 	LOCAL_USER_ADD(u);
 
-	family = ast_strdupa(data);
-	if ((colmatch = strchr(family,'|'))) {
-		crop_data(colmatch);
-		if ((value = strchr(colmatch,'|'))) {
-			crop_data(value);
-			if ((newcol = strchr(value,'|'))) {
-				crop_data(newcol);
-				if ((newval = strchr(newcol,'|'))) 
-					crop_data(newval);
+	if ((family = ast_strdupa(data))) {
+		if ((colmatch = strchr(family,'|'))) {
+			crop_data(colmatch);
+			if ((value = strchr(colmatch,'|'))) {
+				crop_data(value);
+				if ((newcol = strchr(value,'|'))) {
+					crop_data(newcol);
+					if ((newval = strchr(newcol,'|'))) 
+						crop_data(newval);
+				}
 			}
 		}
 	}
-	if (!newval) {
+	if (! (family && value && colmatch && newcol && newval) ) {
 		ast_log(LOG_ERROR,"Invalid input: usage %s\n",UUSAGE);
 		res = -1;
 	} else {
@@ -192,16 +193,17 @@
 	
 	LOCAL_USER_ADD(u);
 
-	family = ast_strdupa(data);
-	if ((colmatch = strchr(family,'|'))) {
-		crop_data(colmatch);
-		if ((value = strchr(colmatch,'|'))) {
-			crop_data(value);
-			if ((prefix = strchr(value,'|')))
-				crop_data(prefix);
+	if ((family = ast_strdupa(data))) {
+		if ((colmatch = strchr(family,'|'))) {
+			crop_data(colmatch);
+			if ((value = strchr(colmatch,'|'))) {
+				crop_data(value);
+				if ((prefix = strchr(value,'|')))
+					crop_data(prefix);
+			}
 		}
 	}
-	if (!value) {
+	if (! (family && value && colmatch) ) {
 		ast_log(LOG_ERROR,"Invalid input: usage %s\n",USAGE);
 		res = -1;
 	} else {

Modified: trunk/apps/app_record.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_record.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_record.c (original)
+++ trunk/apps/app_record.c Sat Jan 21 11:50:04 2006
@@ -117,6 +117,11 @@
 
 	/* Yay for strsep being easy */
 	vdata = ast_strdupa(data);
+	if (!vdata) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	p = vdata;
 	filename = strsep(&p, "|");

Modified: trunk/apps/app_sayunixtime.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_sayunixtime.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_sayunixtime.c (original)
+++ trunk/apps/app_sayunixtime.c Sat Jan 21 11:50:04 2006
@@ -92,21 +92,26 @@
 	} 
 
 	if (data) {
-		s = ast_strdupa(data);
-		timec = strsep(&s,"|");
-		if ((timec) && (*timec != '\0')) {
-			long timein;
-			if (sscanf(timec,"%ld",&timein) == 1) {
-				unixtime = (time_t)timein;
+		s = data;
+		s = ast_strdupa(s);
+		if (s) {
+			timec = strsep(&s,"|");
+			if ((timec) && (*timec != '\0')) {
+				long timein;
+				if (sscanf(timec,"%ld",&timein) == 1) {
+					unixtime = (time_t)timein;
+				}
 			}
-		}
-		if (s) {
-			zone = strsep(&s,"|");
-			if (zone && (*zone == '\0'))
-				zone = NULL;
 			if (s) {
-				format = s;
+				zone = strsep(&s,"|");
+				if (zone && (*zone == '\0'))
+					zone = NULL;
+				if (s) {
+					format = s;
+				}
 			}
+		} else {
+			ast_log(LOG_ERROR, "Out of memory error\n");
 		}
 	}
 

Modified: trunk/apps/app_senddtmf.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_senddtmf.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_senddtmf.c (original)
+++ trunk/apps/app_senddtmf.c Sat Jan 21 11:50:04 2006
@@ -75,6 +75,11 @@
 	LOCAL_USER_ADD(u);
 
 	digits = ast_strdupa(data);
+	if (!digits) {
+		ast_log(LOG_ERROR, "Out of Memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	if ((to = strchr(digits,'|'))) {
 		*to = '\0';

Modified: trunk/apps/app_sendtext.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_sendtext.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_sendtext.c (original)
+++ trunk/apps/app_sendtext.c Sat Jan 21 11:50:04 2006
@@ -87,8 +87,14 @@
 		ast_log(LOG_WARNING, "SendText requires an argument (text[|options])\n");
 		LOCAL_USER_REMOVE(u);
 		return -1;
-	} else
+	} else {
 		parse = ast_strdupa(data);
+		if (!parse) {
+			ast_log(LOG_ERROR, "Out of memory!\n");
+			LOCAL_USER_REMOVE(u);
+			return -1;
+		}
+	}
 	
 	AST_STANDARD_APP_ARGS(args, parse);
 

Modified: trunk/apps/app_setcallerid.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_setcallerid.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_setcallerid.c (original)
+++ trunk/apps/app_setcallerid.c Sat Jan 21 11:50:04 2006
@@ -118,6 +118,11 @@
 	LOCAL_USER_ADD(u);
 	
 	tmp = ast_strdupa(data);
+	if (!tmp) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 	
 	opt = strchr(tmp, '|');
 	if (opt) {

Modified: trunk/apps/app_skel.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_skel.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_skel.c (original)
+++ trunk/apps/app_skel.c Sat Jan 21 11:50:04 2006
@@ -88,6 +88,11 @@
 
 	/* We need to make a copy of the input string if we are going to modify it! */
 	args = ast_strdupa(data);	
+	if (!args) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 	
 	if ((argc = ast_app_separate_args(args, '|', argv, sizeof(argv) / sizeof(argv[0])))) {
 		dummy = argv[0];

Modified: trunk/apps/app_stack.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_stack.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_stack.c (original)
+++ trunk/apps/app_stack.c Sat Jan 21 11:50:04 2006
@@ -130,6 +130,10 @@
 	}
 
 	args = ast_strdupa((char *)data);
+	if (!args) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		return -1;
+	}
 
 	LOCAL_USER_ADD(u);
 

Modified: trunk/apps/app_talkdetect.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_talkdetect.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_talkdetect.c (original)
+++ trunk/apps/app_talkdetect.c Sat Jan 21 11:50:04 2006
@@ -89,6 +89,11 @@
 	LOCAL_USER_ADD(u);
 
 	tmp = ast_strdupa(data);
+	if (!tmp) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}	
 
 	stringp=tmp;
 	strsep(&stringp, "|");

Modified: trunk/apps/app_transfer.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_transfer.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_transfer.c (original)
+++ trunk/apps/app_transfer.c Sat Jan 21 11:50:04 2006
@@ -88,14 +88,19 @@
 
 	LOCAL_USER_ADD(u);
 
-	if (ast_strlen_zero(data)) {
+	if (ast_strlen_zero((char *)data)) {
 		ast_log(LOG_WARNING, "Transfer requires an argument ([Tech/]destination[|options])\n");
 		LOCAL_USER_REMOVE(u);
 		pbx_builtin_setvar_helper(chan, "TRANSFERSTATUS", "FAILURE");
 		return 0;
+	} else {
+		parse = ast_strdupa(data);
+		if (!parse) {
+			ast_log(LOG_ERROR, "Out of memory!\n");
+			LOCAL_USER_REMOVE(u);
+			return -1;
+		}
 	}
-	
-	parse = ast_strdupa(data);
 
 	AST_STANDARD_APP_ARGS(args, parse);
 

Modified: trunk/apps/app_url.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_url.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_url.c (original)
+++ trunk/apps/app_url.c Sat Jan 21 11:50:04 2006
@@ -94,8 +94,14 @@
 
 	LOCAL_USER_ADD(u);
 
-	stringp = tmp = ast_strdupa(data);
+	tmp = ast_strdupa(data);
+	if (!tmp) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
+	stringp=tmp;
 	strsep(&stringp, "|");
 	options = strsep(&stringp, "|");
 	if (options && !strcasecmp(options, "wait"))

Modified: trunk/apps/app_userevent.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_userevent.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_userevent.c (original)
+++ trunk/apps/app_userevent.c Sat Jan 21 11:50:04 2006
@@ -75,6 +75,11 @@
 	LOCAL_USER_ADD(u);
 
 	info = ast_strdupa(data);
+	if (!info) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	snprintf(eventname, sizeof(eventname), "UserEvent%s", info);
 	eventbody = strchr(eventname, '|');

Modified: trunk/apps/app_verbose.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_verbose.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_verbose.c (original)
+++ trunk/apps/app_verbose.c Sat Jan 21 11:50:04 2006
@@ -67,34 +67,38 @@
 	LOCAL_USER_ADD(u);
 
 	if (data) {
-		vtext = ast_strdupa(data);
-		char *tmp = strsep(&vtext, "|,");
+		vtext = ast_strdupa((char *)data);
 		if (vtext) {
-			if (sscanf(tmp, "%d", &vsize) != 1) {
+			char *tmp = strsep(&vtext, "|,");
+			if (vtext) {
+				if (sscanf(tmp, "%d", &vsize) != 1) {
+					vsize = 0;
+					ast_log(LOG_WARNING, "'%s' is not a verboser number\n", vtext);
+				}
+			} else {
+				vtext = tmp;
 				vsize = 0;
-				ast_log(LOG_WARNING, "'%s' is not a verboser number\n", vtext);
+			}
+			if (option_verbose >= vsize) {
+				switch (vsize) {
+				case 0:
+					ast_verbose("%s\n", vtext);
+					break;
+				case 1:
+					ast_verbose(VERBOSE_PREFIX_1 "%s\n", vtext);
+					break;
+				case 2:
+					ast_verbose(VERBOSE_PREFIX_2 "%s\n", vtext);
+					break;
+				case 3:
+					ast_verbose(VERBOSE_PREFIX_3 "%s\n", vtext);
+					break;
+				default:
+					ast_verbose(VERBOSE_PREFIX_4 "%s\n", vtext);
+				}
 			}
 		} else {
-			vtext = tmp;
-			vsize = 0;
-		}
-		if (option_verbose >= vsize) {
-			switch (vsize) {
-			case 0:
-				ast_verbose("%s\n", vtext);
-				break;
-			case 1:
-				ast_verbose(VERBOSE_PREFIX_1 "%s\n", vtext);
-				break;
-			case 2:
-				ast_verbose(VERBOSE_PREFIX_2 "%s\n", vtext);
-				break;
-			case 3:
-				ast_verbose(VERBOSE_PREFIX_3 "%s\n", vtext);
-				break;
-			default:
-				ast_verbose(VERBOSE_PREFIX_4 "%s\n", vtext);
-			}
+			ast_log(LOG_ERROR, "Out of memory\n");
 		}
 	}
 
@@ -117,6 +121,11 @@
 	}
 
 	ltext = ast_strdupa(data);
+	if (!ltext) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		LOCAL_USER_REMOVE(u);
+		return 0;
+	}
 
 	level = strsep(&ltext, "|");
 

Modified: trunk/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_voicemail.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_voicemail.c (original)
+++ trunk/apps/app_voicemail.c Sat Jan 21 11:50:04 2006
@@ -3284,23 +3284,28 @@
 	snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->mailbox, vmu->context);
 
 	/* Attach only the first format */
-	stringp = fmt = ast_strdupa(fmt);
-	strsep(&stringp, "|");
-
-	if (!ast_strlen_zero(vmu->email)) {
-		int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
-		char *myserveremail = serveremail;
-		attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
-		if (!ast_strlen_zero(vmu->serveremail))
-			myserveremail = vmu->serveremail;
-		sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt, duration, attach_user_voicemail, category);
-	}
-
-	if (!ast_strlen_zero(vmu->pager)) {
-		char *myserveremail = serveremail;
-		if (!ast_strlen_zero(vmu->serveremail))
-			myserveremail = vmu->serveremail;
-		sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
+	fmt = ast_strdupa(fmt);
+	if (fmt) {
+		stringp = fmt;
+		strsep(&stringp, "|");
+
+		if (!ast_strlen_zero(vmu->email)) {
+			int attach_user_voicemail = ast_test_flag((&globalflags), VM_ATTACH);
+			char *myserveremail = serveremail;
+			attach_user_voicemail = ast_test_flag(vmu, VM_ATTACH);
+			if (!ast_strlen_zero(vmu->serveremail))
+				myserveremail = vmu->serveremail;
+			sendmail(myserveremail, vmu, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, fn, fmt, duration, attach_user_voicemail, category);
+		}
+
+		if (!ast_strlen_zero(vmu->pager)) {
+			char *myserveremail = serveremail;
+			if (!ast_strlen_zero(vmu->serveremail))
+				myserveremail = vmu->serveremail;
+			sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
+		}
+	} else {
+		ast_log(LOG_ERROR, "Out of memory\n");
 	}
 
 	if (ast_test_flag(vmu, VM_DELETE)) {
@@ -5053,6 +5058,11 @@
 		);
 				        
 		parse = ast_strdupa(data);
+		if (!parse) {
+			ast_log(LOG_ERROR, "Out of memory!\n");
+			LOCAL_USER_REMOVE(u);
+			return -1;
+		}
 
 		AST_STANDARD_APP_ARGS(args, parse);
 
@@ -5638,6 +5648,11 @@
 	LOCAL_USER_ADD(u);
 
 	box = ast_strdupa(data);
+	if (!box) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, box);
 
@@ -5675,6 +5690,10 @@
 	
 	if (s) {
 		s = ast_strdupa(s);
+		if (!s) {
+			ast_log(LOG_ERROR, "Out of memory\n");
+			return -1;
+		}
 		user = strsep(&s, "|");
 		options = strsep(&s, "|");
 		if (user) {
@@ -6121,22 +6140,28 @@
 						if ((z = ast_malloc(sizeof(*z)))) {
 							char *msg_format, *timezone;
 							msg_format = ast_strdupa(var->value);
-							timezone = strsep(&msg_format, "|");
-							if (msg_format) {
-								ast_copy_string(z->name, var->name, sizeof(z->name));
-								ast_copy_string(z->timezone, timezone, sizeof(z->timezone));
-								ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));
-								z->next = NULL;
-								if (zones) {
-									zonesl->next = z;
-									zonesl = z;
+							if (msg_format != NULL) {
+								timezone = strsep(&msg_format, "|");
+								if (msg_format) {
+									ast_copy_string(z->name, var->name, sizeof(z->name));
+									ast_copy_string(z->timezone, timezone, sizeof(z->timezone));
+									ast_copy_string(z->msg_format, msg_format, sizeof(z->msg_format));
+									z->next = NULL;
+									if (zones) {
+										zonesl->next = z;
+										zonesl = z;
+									} else {
+										zones = z;
+										zonesl = z;
+									}
 								} else {
-									zones = z;
-									zonesl = z;
+									ast_log(LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
+									free(z);
 								}
 							} else {
-								ast_log(LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
+								ast_log(LOG_WARNING, "Out of memory while reading voicemail config\n");
 								free(z);
+								return -1;
 							}
 						} else {						
 							return -1;

Modified: trunk/apps/app_while.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_while.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_while.c (original)
+++ trunk/apps/app_while.c Sat Jan 21 11:50:04 2006
@@ -90,6 +90,11 @@
 	LOCAL_USER_ADD(u);
 
 	expr = ast_strdupa(data);
+	if (!expr) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	if ((myapp = strchr(expr,'|'))) {
 		*myapp = '\0';
@@ -239,8 +244,9 @@
 	snprintf(used_index, VAR_SIZE, "%d", used_index_i);
 	snprintf(new_index, VAR_SIZE, "%d", used_index_i + 1);
 	
-	if (!end)
-		condition = ast_strdupa(data);
+	if (!end) {
+		condition = ast_strdupa((char *) data);
+	}
 
 	size = strlen(chan->context) + strlen(chan->exten) + 32;
 	my_name = alloca(size);

Modified: trunk/apps/app_zapras.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_zapras.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/apps/app_zapras.c (original)
+++ trunk/apps/app_zapras.c Sat Jan 21 11:50:04 2006
@@ -210,6 +210,11 @@
 	LOCAL_USER_ADD(u);
 
 	args = ast_strdupa(data);
+	if (!args) {
+		ast_log(LOG_ERROR, "Out of memory\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 	
 	/* Answer the channel if it's not up */
 	if (chan->_state != AST_STATE_UP)

Modified: trunk/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_agent.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/channels/chan_agent.c (original)
+++ trunk/channels/chan_agent.c Sat Jan 21 11:50:04 2006
@@ -329,6 +329,10 @@
 	struct agent_pvt *p, *prev;
 
 	parse = ast_strdupa(agent);
+	if (!parse) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		return NULL;
+	}
 
 	/* Extract username (agt), password and name from agent (args). */
 	AST_NONSTANDARD_APP_ARGS(args, parse, ',');
@@ -1763,7 +1767,11 @@
 
 	LOCAL_USER_ADD(u);
 
-	parse = ast_strdupa(data);
+	if (!(parse = ast_strdupa(data))) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		LOCAL_USER_REMOVE(u);
+		return -1;
+	}
 
 	AST_STANDARD_APP_ARGS(args, parse);
 
@@ -2503,6 +2511,10 @@
 	}
 
 	item = ast_strdupa(data);
+	if (!item) {
+		ast_log(LOG_ERROR, "Out of memory!\n");
+		return buf;
+	}
 
 	agentid	= strsep(&item, ":");
 	if (!item)

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Sat Jan 21 11:50:04 2006
@@ -2784,10 +2784,12 @@
 		char *key = NULL;
 
 		family = ast_strdupa(peer->dbsecret);
-		key = strchr(family, '/');
-		if (key)
-			*key++ = '\0';
-		if (!key || ast_db_get(family, key, cai->secret, sizeof(cai->secret))) {
+		if (family) {
+			key = strchr(family, '/');
+			if (key)
+				*key++ = '\0';
+		}
+		if (!family || !key || ast_db_get(family, key, cai->secret, sizeof(cai->secret))) {
 			ast_log(LOG_WARNING, "Unable to retrieve database password for family/key '%s'!\n", peer->dbsecret);
 			if (ast_test_flag(peer, IAX_TEMPONLY))
 				destroy_peer(peer);
@@ -3904,8 +3906,9 @@
 		unsigned char digest[16];
 		char *tmppw, *stringp;
 		
-		stringp = ast_strdupa(iaxs[callno]->secret);
-		while ((tmppw = strsep(&stringp, ";"))) {
+		tmppw = ast_strdupa(iaxs[callno]->secret);
+		stringp = tmppw;
+		while((tmppw = strsep(&stringp, ";"))) {
 			MD5Init(&md5);
 			MD5Update(&md5, (unsigned char *)iaxs[callno]->challenge, strlen(iaxs[callno]->challenge));
 			MD5Update(&md5, (unsigned char *)tmppw, strlen(tmppw));
@@ -4852,10 +4855,14 @@
 		if (!ast_strlen_zero(user->dbsecret)) {
 			char *family, *key=NULL;
 			family = ast_strdupa(user->dbsecret);
-			key = strchr(family, '/');
-			if (key)
-				*key++ = '\0';
-			if (!key || ast_db_get(family, key, iaxs[callno]->secret, sizeof(iaxs[callno]->secret))) {
+			if (family) {
+				key = strchr(family, '/');
+				if (key) {
+					*key = '\0';
+					key++;
+				}
+			}
+			if (!family || !key || ast_db_get(family, key, iaxs[callno]->secret, sizeof(iaxs[callno]->secret))) {
 				ast_log(LOG_WARNING, "Unable to retrieve database password for family/key '%s'!\n", user->dbsecret);
 				if (ast_test_flag(user, IAX_TEMPONLY)) {
 					destroy_user(user);
@@ -4961,8 +4968,9 @@
 		unsigned char digest[16];
 		char *tmppw, *stringp;
 		
-		stringp = ast_strdupa(p->secret);
-		while ((tmppw = strsep(&stringp, ";"))) {
+		tmppw = ast_strdupa(p->secret);
+		stringp = tmppw;
+		while((tmppw = strsep(&stringp, ";"))) {
 			MD5Init(&md5);
 			MD5Update(&md5, (unsigned char *)p->challenge, strlen(p->challenge));
 			MD5Update(&md5, (unsigned char *)tmppw, strlen(tmppw));
@@ -5090,8 +5098,9 @@
 		unsigned char digest[16];
 		char *tmppw, *stringp;
 		
-		stringp = ast_strdupa(p->secret);
-		while ((tmppw = strsep(&stringp, ";"))) {
+		tmppw = ast_strdupa(p->secret);
+		stringp = tmppw;
+		while((tmppw = strsep(&stringp, ";"))) {
 			MD5Init(&md5);
 			MD5Update(&md5, (unsigned char *)iaxs[callno]->challenge, strlen(iaxs[callno]->challenge));
 			MD5Update(&md5, (unsigned char *)tmppw, strlen(tmppw));
@@ -8025,6 +8034,10 @@
 	char *portstr;
 
 	tmp = ast_strdupa(srcaddr);
+	if (!tmp) {
+		ast_log(LOG_WARNING, "Out of memory!\n");
+		return -1;
+	}
 
 	addr = strsep(&tmp, ":");
 	portstr = tmp;
@@ -8322,7 +8335,7 @@
 				user->ha = ast_append_ha(v->name, v->value, user->ha);
 			} else if (!strcasecmp(v->name, "setvar")) {
 				varname = ast_strdupa(v->value);
-				if ((varval = strchr(varname,'='))) {
+				if (varname && (varval = strchr(varname,'='))) {
 					*varval = '\0';
 					varval++;
 					if((tmpvar = ast_variable_new(varname, varval))) {
@@ -9161,7 +9174,10 @@
 	char *peername, *colname;
 	char iabuf[INET_ADDRSTRLEN];
 
-	peername = ast_strdupa(data);
+	if (!(peername = ast_strdupa(data))) {
+		ast_log(LOG_ERROR, "Memory Error!\n");
+		return ret;
+	}
 
 	/* if our channel, return the IP address of the endpoint of current channel */
 	if (!strcmp(peername,"CURRENTCHANNEL")) {

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=8387&r1=8386&r2=8387&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sat Jan 21 11:50:04 2006
@@ -1860,9 +1860,12 @@
 		char *tmpcall;
 		char *c;
 		tmpcall = ast_strdupa(r->callid);
-		if ((c = strchr(tmpcall, '@'))) {
-			*c = '\0';
-			ast_string_field_build(r, callid, "%s@%s", tmpcall, peer->fromdomain);
+		if (tmpcall) {
+			c = strchr(tmpcall, '@');
+			if (c) {
+				*c = '\0';
+				ast_string_field_build(r, callid, "%s@%s", tmpcall, peer->fromdomain);
+			}
 		}
 	}
 	if (ast_strlen_zero(r->tohost)) {
@@ -7054,8 +7057,12 @@
 		if ((c = strchr(of, ':')))
 			*c = '\0';
 		tmp = ast_strdupa(of);
-		ast_shrink_phone_number(tmp);
-		ast_string_field_set(p, cid_num, tmp);
+		if (tmp) {
+			ast_shrink_phone_number(tmp);

[... 387 lines stripped ...]


More information about the asterisk-commits mailing list