[Asterisk-cvs] asterisk/apps app_curl.c,1.6,1.7

russell at lists.digium.com russell at lists.digium.com
Thu May 26 12:11:56 CDT 2005


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

Modified Files:
	app_curl.c 
Log Message:
fix seg fault when the app is called on an invalid url (bug #4389)


Index: app_curl.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_curl.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- app_curl.c	21 Apr 2005 06:02:43 -0000	1.6
+++ app_curl.c	26 May 2005 16:15:58 -0000	1.7
@@ -115,13 +115,15 @@
 		curl_easy_perform(curl);
 		curl_easy_cleanup(curl);
 
-		chunk.memory[chunk.size] = '\0';
-		if (chunk.memory[chunk.size - 1] == 10)
-			chunk.memory[chunk.size - 1] = '\0';
+		if (chunk.memory) {
+			chunk.memory[chunk.size] = '\0';
+			if (chunk.memory[chunk.size - 1] == 10)
+				chunk.memory[chunk.size - 1] = '\0';
 
-		pbx_builtin_setvar_helper(chan, "CURL", chunk.memory);
+			pbx_builtin_setvar_helper(chan, "CURL", chunk.memory);
 
-		free(chunk.memory);
+			free(chunk.memory);
+		}
 	} else {
 		ast_log(LOG_ERROR, "Cannot allocate curl structure\n");
 		res = -1;




More information about the svn-commits mailing list