curl-library
RE: Patrick: Diff for /curl/lib/url.c between version 1.656 and 1.657
Date: Fri, 19 Oct 2007 15:26:17 +0200
Yang Tse wrote:
> But I think that this 1 byte malloc isn't the long term proper fix.
The alternate solution is to store some static (like if performed with
CURLOPT_POSTFIELDS) pointer. It can be:
A) NULL
B) the user-data pointer
C) A curl-internal dummy data pointer.
All these solutions have drawbacks:
_ A) directs the later code to use the callback function or the form
data. That is not what we want, even when the length is 0.
_ If CURLOPT_POSTFIELDSIZE/CURLOPT_POSTFIELDSIZE_LARGE is called again
AFTER, the pointer set as B) or C) is not erased because it has not been
allocated, allowing to access data outside the (0-length) pointed
buffer.
This malloc(1) solution is a very little resource sacrifice compared to
the other solution's inconvenients.
Received on 2007-10-19