]> granicus.if.org Git - curl/commitdiff
Fix overflow detection, thanks to Patrick Monnerat detecting test
authorYang Tse <yangsita@gmail.com>
Wed, 17 Oct 2007 18:06:32 +0000 (18:06 +0000)
committerYang Tse <yangsita@gmail.com>
Wed, 17 Oct 2007 18:06:32 +0000 (18:06 +0000)
failure condition: http://curl.haxx.se/mail/lib-2007-10/0152.html

lib/url.c

index eab1d6d55e8395950d70f598d7f8d01078901f8d..35d2d046b0e1e47b131e87ea8b17f6acf712f43c 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -1039,8 +1039,9 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
        *  Check that request length does not overflow the size_t type.
        */
 
-      if ((data->set.postfieldsize < 0) ||
-          (data->set.postfieldsize > (curl_off_t)((size_t)-1)))
+      if ((sizeof(curl_off_t) != sizeof(size_t)) &&
+          ((data->set.postfieldsize < 0) ||
+           (data->set.postfieldsize > (curl_off_t)((size_t)-1))))
         result = CURLE_OUT_OF_MEMORY;
       else {
         char * p;