diff options
Diffstat (limited to 'content/fetch.c')
-rw-r--r-- | content/fetch.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/content/fetch.c b/content/fetch.c index 78fd53812..d5bd31733 100644 --- a/content/fetch.c +++ b/content/fetch.c @@ -735,9 +735,9 @@ struct curl_httppost *fetch_post_convert(struct form_successful_control *control temp = control->value; /* already leafname */ else temp += 1; - leafname = malloc(strlen(temp)); + leafname = calloc(strlen(temp)+5, sizeof(char)); if (!leafname) { - LOG(("malloc failed")); + LOG(("calloc failed")); free(mimetype); continue; } @@ -751,7 +751,8 @@ struct curl_httppost *fetch_post_convert(struct form_successful_control *control #endif curl_formadd(&post, &last, CURLFORM_COPYNAME, control->name, - CURLFORM_FILE, leafname, + CURLFORM_FILE, control->value, + CURLFORM_FILENAME, leafname, CURLFORM_CONTENTTYPE, (mimetype != 0 ? mimetype : "text/plain"), CURLFORM_END); @@ -798,6 +799,7 @@ bool fetch_can_fetch(const char *url) if (strlen(data->protocols[i]) == len && strncasecmp(url, data->protocols[i], len) == 0) return true; + return false; } |