1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Fix overflow detection, take four. Avoiding zero size malloc.

This commit is contained in:
Yang Tse 2007-10-17 19:29:06 +00:00
parent 420ea83ef3
commit 0164f0cf81

View File

@ -1039,8 +1039,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* Check that request length does not overflow the size_t type.
*/
if ((sizeof(curl_off_t) != sizeof(size_t)) &&
((data->set.postfieldsize < 0) ||
if ((data->set.postfieldsize < 1) ||
((sizeof(curl_off_t) != sizeof(size_t)) &&
(data->set.postfieldsize > (curl_off_t)((size_t)-1))))
result = CURLE_OUT_OF_MEMORY;
else {