summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-network.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/core/wee-network.c b/src/core/wee-network.c
index 0e68d2bb1..3e7d4e2cf 100644
--- a/src/core/wee-network.c
+++ b/src/core/wee-network.c
@@ -554,11 +554,13 @@ network_pass_socks4proxy (struct t_proxy *proxy, int sock, const char *address,
socks4.method = 1;
socks4.port = htons (port);
network_resolve (address, ip_addr, NULL);
- socks4.address = inet_addr (ip_addr);
strncpy (socks4.user, username, sizeof (socks4.user) - 1);
free (username);
+ if (inet_pton (AF_INET, ip_addr, &socks4.address) != 1)
+ return 0;
+
length = 8 + strlen (socks4.user) + 1;
if (network_send_with_retry (sock, (char *) &socks4, length, 0) != length)
return 0;