Skip to content

Commit

Permalink
socks.c: Check that IPv6 is enabled before using it's features
Browse files Browse the repository at this point in the history
  • Loading branch information
mback2k committed Sep 14, 2012
1 parent 8a2be29 commit 5162cb8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/socks.c
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,9 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
hp=dns->addr;
if(hp) {
struct sockaddr_in *saddr_in;
#ifdef ENABLE_IPV6
struct sockaddr_in6 *saddr_in6;
#endif
int i;

if(hp->ai_family == AF_INET) {
Expand All @@ -600,6 +602,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
infof(data, "%d\n", socksreq[len-1]);
}
}
#ifdef ENABLE_IPV6
else if(hp->ai_family == AF_INET6) {
socksreq[len++] = 4; /* ATYP: IPv6 = 4 */

Expand All @@ -608,6 +611,7 @@ CURLcode Curl_SOCKS5(const char *proxy_name,
socksreq[len++] = ((unsigned char*)&saddr_in6->sin6_addr.s6_addr)[i];
}
}
#endif
else
hp = NULL; /* fail! */

Expand Down

0 comments on commit 5162cb8

Please sign in to comment.