[Asterisk-cvs] asterisk pbx.c,1.164,1.165

anthm at lists.digium.com anthm at lists.digium.com
Tue Oct 26 21:30:43 CDT 2004


Update of /usr/cvsroot/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv4507

Modified Files:
	pbx.c 
Log Message:
add more paranoid handling to pbx_builtin_serialize_variables


Index: pbx.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx.c,v
retrieving revision 1.164
retrieving revision 1.165
diff -u -d -r1.164 -r1.165
--- pbx.c	24 Oct 2004 02:53:24 -0000	1.164
+++ pbx.c	27 Oct 2004 01:34:06 -0000	1.165
@@ -4921,18 +4921,21 @@
 {
 	struct ast_var_t *variables;
 	struct varshead *headp;
+	char *var=NULL ,*val=NULL;
 	int total = 0;
 
 	memset(buf,0,size);
 	if (chan) {
 		headp=&chan->varshead;
 		AST_LIST_TRAVERSE(headp,variables,entries) {
-			snprintf(buf + strlen(buf), size - strlen(buf), "%s=%s\n", ast_var_name(variables), ast_var_value(variables));
-			if(strlen(buf) >= size) {
-				ast_log(LOG_ERROR,"Data Buffer Size Exceeded!\n");
-				break;
+			if(chan && variables && (var=ast_var_name(variables)) && (val=ast_var_value(variables))) {
+				snprintf(buf + strlen(buf), size - strlen(buf), "%s=%s\n", var, val);
+				if(strlen(buf) >= size) {
+					ast_log(LOG_ERROR,"Data Buffer Size Exceeded!\n");
+					break;
+				}
+				total++;
 			}
-			total++;
 		}
 	}
 	




More information about the svn-commits mailing list