aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/warnless.c19
-rw-r--r--lib/warnless.h2
-rw-r--r--src/tool_getparam.c4
3 files changed, 23 insertions, 2 deletions
diff --git a/lib/warnless.c b/lib/warnless.c
index 778f098f5..8c130d34c 100644
--- a/lib/warnless.c
+++ b/lib/warnless.c
@@ -175,6 +175,25 @@ int curlx_ultosi(unsigned long ulnum)
}
/*
+** unsigned size_t to signed curl_off_t
+*/
+
+curl_off_t curlx_uztoso(size_t uznum)
+{
+#ifdef __INTEL_COMPILER
+# pragma warning(push)
+# pragma warning(disable:810) /* conversion may lose significant bits */
+#endif
+
+ DEBUGASSERT(uznum <= (size_t) CURL_MASK_SCOFFT);
+ return (curl_off_t)(uznum & (size_t) CURL_MASK_SCOFFT);
+
+#ifdef __INTEL_COMPILER
+# pragma warning(pop)
+#endif
+}
+
+/*
** unsigned size_t to signed int
*/
diff --git a/lib/warnless.h b/lib/warnless.h
index 33368d207..ad77d3c20 100644
--- a/lib/warnless.h
+++ b/lib/warnless.h
@@ -34,6 +34,8 @@ int curlx_ultosi(unsigned long ulnum);
int curlx_uztosi(size_t uznum);
+curl_off_t curlx_uztoso(size_t uznum);
+
unsigned long curlx_uztoul(size_t uznum);
unsigned int curlx_uztoui(size_t uznum);
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index 6d68c5b40..9ac6ab2fc 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -1239,7 +1239,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
&-letter */
char *oldpost = config->postfields;
curl_off_t oldlen = config->postfieldsize;
- curl_off_t newlen = oldlen + size + 2;
+ curl_off_t newlen = oldlen + curlx_uztoso(size) + 2;
config->postfields = malloc((size_t)newlen);
if(!config->postfields) {
Curl_safefree(oldpost);
@@ -1257,7 +1257,7 @@ ParameterError getparameter(char *flag, /* f or -long-flag */
}
else {
config->postfields = postdata;
- config->postfieldsize = size;
+ config->postfieldsize = curlx_uztoso(size);
}
}
/*