cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: out of memory error while posting form data

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 29 Jul 2008 20:45:32 -0700

On Tue, Jul 29, 2008 at 08:21:08PM -0700, deva seetharam wrote:
> here is the code (with the error checking removed, for brevity). it is arelatively simple code that posts a form with 3 text fields and 1 data file.

> int curlUploadData(char* data, unsigned int dataSize) {
[...]
> /* Add the transmit buffer as a file upload as multipart form data,
> with form item name "datafile" */
> curl_formadd(&post, &last,
> CURLFORM_COPYNAME, "datafile",
> CURLFORM_BUFFER, "filename",
> CURLFORM_BUFFERPTR, data,
> CURLFORM_BUFFERLENGTH, dataSize,
> CURLFORM_END);

       CURLFORM_BUFFERLENGTH
              is used in combination with CURLFORM_BUFFER. The
              parameter is a long which gives the length of the
              buffer.

dataSize is an unsigned int, not a long like it should be. On 32-bit x86
Linux they're the same length, but on x86-64, they're not. That's probably
the problem right there.

>>> Dan

-- 
http://www.MoveAnnouncer.com              The web change of address service
          Let webmasters know that your web site has moved
Received on 2008-07-30