summaryrefslogtreecommitdiff
path: root/lib/curl_setup.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2018-03-20 15:15:14 +0100
committerDaniel Stenberg <daniel@haxx.se>2018-03-20 19:25:50 +0100
commitc1366571b609407cf0d4d9f4a2769d29e1313151 (patch)
tree38d0ac65b3a1303b97b9065aca308d44c3f4dbfa /lib/curl_setup.h
parentf623ad65e81c76f34130be272a4efe1d1abe1e13 (diff)
downloadcurl-c1366571b609407cf0d4d9f4a2769d29e1313151.tar.gz
vauth/cleartext: fix integer overflow check
Make the integer overflow check not rely on the undefined behavior that a size_t wraps around on overflow. Detected by lgtm.com Closes #2408
Diffstat (limited to 'lib/curl_setup.h')
-rw-r--r--lib/curl_setup.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/curl_setup.h b/lib/curl_setup.h
index f128696e9..e4503c64c 100644
--- a/lib/curl_setup.h
+++ b/lib/curl_setup.h
@@ -447,6 +447,15 @@
# endif
#endif
+#ifndef SIZE_T_MAX
+/* some limits.h headers have this defined, some don't */
+#if defined(SIZEOF_SIZE_T) && (SIZEOF_SIZE_T > 4)
+#define SIZE_T_MAX 18446744073709551615U
+#else
+#define SIZE_T_MAX 4294967295U
+#endif
+#endif
+
/*
* Arg 2 type for gethostname in case it hasn't been defined in config file.
*/