[pacman-dev] [PATCH 2/2] stop progress callbacks after curl_easy_perform returns

Dave Reisner d at falconindy.com
Thu Aug 11 09:04:52 EDT 2011


This prevents possible null dereferences in FTP transfers when the
progress callback is touched during connection teardown.

http://curl.haxx.se/mail/lib-2011-08/0128.html

Signed-off-by: Dave Reisner <dreisner at archlinux.org>
---
This makes me unhappy.

 lib/libalpm/dload.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 689fe6e..e655a13 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -302,6 +302,9 @@ static int curl_download_internal(struct dload_payload *payload,
 	/* perform transfer */
 	handle->curlerr = curl_easy_perform(handle->curl);
 
+	/* immediately unhook the progress callback */
+	curl_easy_setopt(handle->curl, CURLOPT_NOPROGRESS, 1L);
+
 	/* was it a success? */
 	if(handle->curlerr == CURLE_ABORTED_BY_CALLBACK) {
 		goto cleanup;
-- 
1.7.6



More information about the pacman-dev mailing list