From 3ef770e2cd50aee0bb65be1c1a0705320261d36b Mon Sep 17 00:00:00 2001 From: Bjoern Sikora Date: Thu, 17 Sep 2009 17:17:31 +0200 Subject: [PATCH] Bugfix: Avoid curl from segfaulting when CurlErrBuff is filled. Allocate CurlErrBuff with CURL_ERROR_SIZE. --- src/httphelper.cpp | 3 +-- src/httphelper.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/httphelper.cpp b/src/httphelper.cpp index 18aec0a..890388d 100644 --- a/src/httphelper.cpp +++ b/src/httphelper.cpp @@ -50,7 +50,6 @@ HTTPHelper::~HTTPHelper() { // Free memory curl_easy_cleanup(CurlEasyHandle); - free(CurlErrBuff); } @@ -73,7 +72,7 @@ long HTTPHelper::http_get(const string& url) } if ( (curl_err_code = curl_easy_getinfo(CurlEasyHandle,CURLINFO_RESPONSE_CODE,&curl_info)) != 0 ) { - Log->print_curl_error(url,curl_err_code); + Log->print_curl_error(url,curl_err_code); return -1; } diff --git a/src/httphelper.h b/src/httphelper.h index 1f987dc..09701d0 100644 --- a/src/httphelper.h +++ b/src/httphelper.h @@ -26,7 +26,7 @@ private: int ProxyPort; CURL* CurlEasyHandle; std::string CurlWritedataBuff; - char* CurlErrBuff; + char CurlErrBuff[CURL_ERROR_SIZE]; void set_curl_url(const std::string& url); void set_curl_auth(const std::string& username, const std::string& password); -- 1.7.1