From: Yang Tse Date: Wed, 17 Oct 2007 19:29:06 +0000 (+0000) Subject: Fix overflow detection, take four. Avoiding zero size malloc. X-Git-Tag: curl-7_17_1~60 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0164f0cf81413948c756e3a7f7003ec5b1094149;p=curl Fix overflow detection, take four. Avoiding zero size malloc. --- diff --git a/lib/url.c b/lib/url.c index 35d2d046b..b0bc96a3b 100644 --- a/lib/url.c +++ b/lib/url.c @@ -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 {