summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/socks.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-06-27 20:44:08 (GMT)
committerBrad King <brad.king@kitware.com>2013-06-27 20:46:23 (GMT)
commite643e0259df0736022d484c68a6781c3a380dd06 (patch)
tree418389d17651ae40b59f4fb5cd6383c91cc4c95d /Utilities/cmcurl/socks.c
parent5dd8c01429da90a7417b72f17e784cc98f70f57c (diff)
downloadCMake-e643e0259df0736022d484c68a6781c3a380dd06.zip
CMake-e643e0259df0736022d484c68a6781c3a380dd06.tar.gz
CMake-e643e0259df0736022d484c68a6781c3a380dd06.tar.bz2
cmcurl: Backport curl bug 1192 fix (#14250)
LLVM headers define strlcat as a macro rather than as a function. See upstream Curl issue: http://curl.haxx.se/bug/view.cgi?id=1192 It was addressed by removing use of strlcat altogether. Port the upstream fix to CMake's curl.
Diffstat (limited to 'Utilities/cmcurl/socks.c')
-rw-r--r--Utilities/cmcurl/socks.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/Utilities/cmcurl/socks.c b/Utilities/cmcurl/socks.c
index 3319e69..e0e947b 100644
--- a/Utilities/cmcurl/socks.c
+++ b/Utilities/cmcurl/socks.c
@@ -199,8 +199,15 @@ CURLcode Curl_SOCKS4(const char *proxy_name,
* This is currently not supporting "Identification Protocol (RFC1413)".
*/
socksreq[8] = 0; /* ensure empty userid is NUL-terminated */
- if (proxy_name)
- strlcat((char*)socksreq + 8, proxy_name, sizeof(socksreq) - 8);
+ if(proxy_name) {
+ size_t plen = strlen(proxy_name);
+ if(plen >= sizeof(socksreq) - 8) {
+ failf(data, "Too long SOCKS proxy name, can't use!\n");
+ return CURLE_COULDNT_CONNECT;
+ }
+ /* copy the proxy name WITH trailing zero */
+ memcpy(socksreq + 8, proxy_name, plen+1);
+ }
/*
* Make connection