aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2007-10-16 23:32:02 +0000
committerYang Tse <yangsita@gmail.com>2007-10-16 23:32:02 +0000
commitc6ef31955a3990f28a009fd0a63127fada7bbffb (patch)
treecd381f5bdb5d0584e3439c5253236f9b439b5333
parent92aaff009d0a2e5ade970fb3700ca2d516ff12ec (diff)
ANSI C compliant overflow check
-rw-r--r--lib/url.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/url.c b/lib/url.c
index 461bfe36b..e605fdcd0 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -1047,10 +1047,8 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
* Check that request length does not overflow the size_t type.
*/
- if ((curl_off_t) ((size_t) data->set.postfieldsize) !=
- data->set.postfieldsize ||
- data->set.postfieldsize < (curl_off_t) 0 ||
- (size_t) data->set.postfieldsize < (size_t) 0)
+ if ((data->set.postfieldsize < 0) ||
+ (data->set.postfieldsize > (curl_off_t)((size_t)-1)))
result = CURLE_OUT_OF_MEMORY;
else {
char * p;