cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: yangtse: curl/lib url.c,1.673,1.674

From: Michal Marek <mmarek_at_suse.cz>
Date: Mon, 12 Nov 2007 13:22:46 +0100

Yang Tse wrote:
>> 'postfieldsize' is 64-bit signed on my platform (Win32), but memcpy()
>> cannot cope with more than 32-bit of it (allthough this should be
>> plenty). But it leaves me wondering why 'postfieldsize' needs to be
>> so large....
>
> Obviously, neither memcpy() nor malloc() will be capable of correctly
> handling anything bigger than a size_t.
>
> Since at some point postfieldsize is assigned a -1 value for further
> checks, obviously it needs to be held by a signed type. And in order
> to also be capable of handling the same values as a size_t, a signed
> type bigger than size_t, such as curl_off_t, has to be used.

I believe the reason is that you can provide the POST data via a read
callback, with no limit on size. That's why there's also the
CURLOPT_POSTFIELDSIZE_LARGE option.

Michal
Received on 2007-11-12