From: Bjoern Sikora Date: Thu, 17 Sep 2009 15:17:31 +0000 (+0200) Subject: Bugfix: Avoid curl from segfaulting when CurlErrBuff is filled. Allocate CurlErrBuff... X-Git-Tag: v1.1~181 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=3ef770e2cd50aee0bb65be1c1a0705320261d36b;p=bpdyndnsd Bugfix: Avoid curl from segfaulting when CurlErrBuff is filled. Allocate CurlErrBuff with CURL_ERROR_SIZE. --- 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);