summaryrefslogtreecommitdiff
path: root/src/tool_setopt.c
diff options
context:
space:
mode:
authorPatrick Monnerat <patrick@monnerat.net>2017-09-22 01:08:29 +0100
committerPatrick Monnerat <patrick@monnerat.net>2017-09-22 01:08:29 +0100
commitee56fdb6910f6bf215eecede9e2e9bfc83cb5f29 (patch)
treebfdbf1f3f2f5cd9f051f6b8d0b2469c51b2660ef /src/tool_setopt.c
parentfa9482ab0907dfacd0fb619add2dbf41de2d8c9c (diff)
downloadcurl-ee56fdb6910f6bf215eecede9e2e9bfc83cb5f29.tar.gz
form/mime: field names are not allowed to contain zero-valued bytes.
Also suppress length argument of curl_mime_name() (names are always zero-terminated).
Diffstat (limited to 'src/tool_setopt.c')
-rw-r--r--src/tool_setopt.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/tool_setopt.c b/src/tool_setopt.c
index fd9bba4d6..fb2cb66d3 100644
--- a/src/tool_setopt.c
+++ b/src/tool_setopt.c
@@ -525,20 +525,10 @@ static CURLcode libcurl_generate_mime(curl_mime *mime, int *mimeno)
if(part->name) {
Curl_safefree(escaped);
- escaped = c_escape(part->name, part->namesize);
+ escaped = c_escape(part->name, CURL_ZERO_TERMINATED);
if(!escaped)
return CURLE_OUT_OF_MEMORY;
- /* Are there any nul byte in name? */
- for(cp = part->name; *cp; cp++)
- ;
- if(cp != part->name + part->namesize) {
- size = (curl_off_t) part->namesize;
- CODE3("curl_mime_name(part%d, \"%s\", %" CURL_FORMAT_CURL_OFF_T ");",
- *mimeno, escaped, size);
- }
- else
- CODE2("curl_mime_name(part%d, \"%s\", CURL_ZERO_TERMINATED);",
- *mimeno, escaped);
+ CODE2("curl_mime_name(part%d, \"%s\");", *mimeno, escaped);
}
if(part->mimetype) {