From 3bd67a47fa73bc5240ceb72838ba42f1b2d80349 Mon Sep 17 00:00:00 2001 From: Andre Rudlaff Date: Sat, 27 Apr 2013 17:55:07 +0200 Subject: [PATCH] Fixed crash in HttpClient request on 64Bit According to the cURL documentation the pointer that should be passed to curl_easy_getinfo with CURLINFO_RESPONSE_CODE must be a long pointer, On platforms where long is 64Bit this will cause a stack corruption destroying the pointer to the original resonse as the current response code variable was a 32 Bit int value. See: http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html --- extensions/network/HttpClient.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/extensions/network/HttpClient.cpp b/extensions/network/HttpClient.cpp index 47cb9429d1..1489a638e9 100644 --- a/extensions/network/HttpClient.cpp +++ b/extensions/network/HttpClient.cpp @@ -74,9 +74,9 @@ size_t writeData(void *ptr, size_t size, size_t nmemb, void *stream) // Prototypes bool configureCURL(CURL *handle); -int processGetTask(CCHttpRequest *request, write_callback callback, void *stream, int32_t *errorCode); -int processPostTask(CCHttpRequest *request, write_callback callback, void *stream, int32_t *errorCode); -// int processDownloadTask(HttpRequest *task, write_callback callback, void *stream, int32_t *errorCode); +int processGetTask(CCHttpRequest *request, write_callback callback, void *stream, long *errorCode); +int processPostTask(CCHttpRequest *request, write_callback callback, void *stream, long *errorCode); +// int processDownloadTask(HttpRequest *task, write_callback callback, void *stream, long *errorCode); // Worker thread @@ -119,7 +119,7 @@ static void* networkThread(void *data) request->release(); // ok, refcount = 1 now, only HttpResponse hold it. - int responseCode = -1; + long responseCode = -1; int retValue = 0; // Process the request -> get response packet @@ -217,7 +217,7 @@ bool configureCURL(CURL *handle) } //Process Get Request -int processGetTask(CCHttpRequest *request, write_callback callback, void *stream, int *responseCode) +int processGetTask(CCHttpRequest *request, write_callback callback, void *stream, long *responseCode) { CURLcode code = CURL_LAST; CURL *curl = curl_easy_init(); @@ -295,7 +295,7 @@ int processGetTask(CCHttpRequest *request, write_callback callback, void *stream } //Process POST Request -int processPostTask(CCHttpRequest *request, write_callback callback, void *stream, int32_t *responseCode) +int processPostTask(CCHttpRequest *request, write_callback callback, void *stream, long *responseCode) { CURLcode code = CURL_LAST; CURL *curl = curl_easy_init();