diff options
Diffstat (limited to 'Utilities/cmcurl/socks.c')
-rw-r--r-- | Utilities/cmcurl/socks.c | 11 |
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 |