]> granicus.if.org Git - curl/commitdiff
Fix overflow detection, take four. Avoiding zero size malloc.
authorYang Tse <yangsita@gmail.com>
Wed, 17 Oct 2007 19:29:06 +0000 (19:29 +0000)
committerYang Tse <yangsita@gmail.com>
Wed, 17 Oct 2007 19:29:06 +0000 (19:29 +0000)
lib/url.c

index 35d2d046b0e1e47b131e87ea8b17f6acf712f43c..b0bc96a3b545471a88bf06b2501fb4280122d48b 100644 (file)
--- 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 {