Skip to content

Commit

Permalink
mime: fix the content reader to handle >16K data properly
Browse files Browse the repository at this point in the history
Reported-by: Jeroen Ooms
Closes #1988
  • Loading branch information
bagder committed Oct 13, 2017
1 parent 0401734 commit 5f9e2ca
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/mime.c
Original file line number Diff line number Diff line change
Expand Up @@ -620,14 +620,13 @@ static size_t mime_mem_read(char *buffer, size_t size, size_t nitems,
{
curl_mimepart *part = (curl_mimepart *) instream;
size_t sz = (size_t) part->datasize - part->state.offset;

(void) size; /* Always 1.*/

if(sz > nitems)
sz = nitems;

if(sz)
memcpy(buffer, (char *) part->data, sz);
memcpy(buffer, (char *) &part->data[part->state.offset], sz);

part->state.offset += sz;
return sz;
Expand Down

0 comments on commit 5f9e2ca

Please sign in to comment.