[svn-commits] branch 1.2 - r8074 /branches/1.2/funcs/func_strings.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sat Jan 14 13:06:45 CST 2006


Author: tilghman
Date: Sat Jan 14 13:06:44 2006
New Revision: 8074

URL: http://svn.digium.com/view/asterisk?rev=8074&view=rev
Log:
Bug 6238 - Fix segfault when delimiter not specified

Modified:
    branches/1.2/funcs/func_strings.c

Modified: branches/1.2/funcs/func_strings.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/funcs/func_strings.c?rev=8074&r1=8073&r2=8074&view=diff
==============================================================================
--- branches/1.2/funcs/func_strings.c (original)
+++ branches/1.2/funcs/func_strings.c Sat Jan 14 13:06:44 2006
@@ -48,8 +48,12 @@
 	if (delim) {
 		varname = strsep(&delim, "|");
 		pbx_retrieve_variable(chan, varname, &varval, workspace, sizeof(workspace), NULL);
-		while (strsep(&varval, delim))
-			fieldcount++;
+		if (delim) {
+			while (strsep(&varval, delim))
+				fieldcount++;
+		} else if (!ast_strlen_zero(varval)) {
+			fieldcount = 1;
+		}
 		snprintf(buf, len, "%d", fieldcount);
 	} else {
 		ast_log(LOG_ERROR, "Out of memory\n");



More information about the svn-commits mailing list