* Fix mouse down grab counts going bad by missing events.
+2011-12-29 Carsten Haitzler (The Rasterman)
+
+ * Fix massive post data probile in ecore-con that would cause
+ post data to be corrupted (as it was never copied into the
+ ecore con url struct) or could cause crashes if the memory
+ pointed to became invalid.
+
EINA_LIST_FREE(url_con->response_headers, s)
free(s);
eina_stringshare_del(url_con->url);
+ if (url_con->post_data) free(url_con->post_data);
free(url_con);
#else
return;
#ifdef HAVE_CURL
Eina_List *l;
const char *s;
- char tmp[256];
+ char tmp[512];
if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL))
{
if ((mode == MODE_POST) || (mode == MODE_AUTO))
{
- if (data)
+ if (url_con->post_data) free(url_con->post_data);
+ url_con->post_data = NULL;
+ if ((data) && (length > 0))
{
- if ((content_type) && (strlen(content_type) < 200))
+ url_con->post_data = malloc(length);
+ if (url_con->post_data)
{
- snprintf(tmp, sizeof(tmp), "Content-Type: %s", content_type);
- url_con->headers = curl_slist_append(url_con->headers, tmp);
+ memcpy(url_con->post_data, data, length);
+ if ((content_type) && (strlen(content_type) < 450))
+ {
+ snprintf(tmp, sizeof(tmp), "Content-Type: %s", content_type);
+ url_con->headers = curl_slist_append(url_con->headers, tmp);
+ }
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDS, url_con->post_data);
+ curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, length);
}
-
- curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDS, data);
- curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, length);
+ else
+ return EINA_FALSE;
}
else curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, 0);
if (mode == MODE_POST)