1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 15:48:49 -05:00

mime: fix the content reader to handle >16K data properly

Reported-by: Jeroen Ooms
Closes #1988
This commit is contained in:
Daniel Stenberg 2017-10-13 00:13:41 +02:00
parent 0401734dfd
commit 5f9e2ca09b
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -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;