summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuK1337 <priv.luk@gmail.com>2023-09-26 15:33:36 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-09-26 17:12:03 +0200
commit0bb59989883ca5f25b4131a73e9f783d29070972 (patch)
treefae88fb0ba64f1b94c4e9a817493290b74a7db5f
parentb58f70454220b28402e1baa1e1e2c5152e540448 (diff)
downloadweechat-0bb59989883ca5f25b4131a73e9f783d29070972.zip
core: replace inet_addr() with inet_pton()
man pages as well as rpminspect suggest that we shouldn't be using inet_addr().
-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;