mirror of
https://github.com/moparisthebest/curl
synced 2024-12-21 23:58:49 -05:00
mime: fix the content reader to handle >16K data properly
Reported-by: Jeroen Ooms Closes #1988
This commit is contained in:
parent
0401734dfd
commit
5f9e2ca09b
@ -620,14 +620,13 @@ static size_t mime_mem_read(char *buffer, size_t size, size_t nitems,
|
|||||||
{
|
{
|
||||||
curl_mimepart *part = (curl_mimepart *) instream;
|
curl_mimepart *part = (curl_mimepart *) instream;
|
||||||
size_t sz = (size_t) part->datasize - part->state.offset;
|
size_t sz = (size_t) part->datasize - part->state.offset;
|
||||||
|
|
||||||
(void) size; /* Always 1.*/
|
(void) size; /* Always 1.*/
|
||||||
|
|
||||||
if(sz > nitems)
|
if(sz > nitems)
|
||||||
sz = nitems;
|
sz = nitems;
|
||||||
|
|
||||||
if(sz)
|
if(sz)
|
||||||
memcpy(buffer, (char *) part->data, sz);
|
memcpy(buffer, (char *) &part->data[part->state.offset], sz);
|
||||||
|
|
||||||
part->state.offset += sz;
|
part->state.offset += sz;
|
||||||
return sz;
|
return sz;
|
||||||
|
Loading…
Reference in New Issue
Block a user