Skip to content

Commit 64a7cd2

Browse files
committed
fix case where proxy was using a DNS name or non-dotted ipv4
it is generally invalid to use a DNS name since DNS subsystem is only available once connected to the proxy; because DNS is done server-side. closes #19
1 parent 9f6ed6e commit 64a7cd2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/libproxychains.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,12 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ
192192

193193
sscanf(buff, "%s %s %d %s %s", type, host, &port_n, pd[count].user, pd[count].pass);
194194

195-
pd[count].ip.as_int = (uint32_t) inet_addr(host);
195+
in_addr_t host_ip = inet_addr(host);
196+
if(host_ip == INADDR_NONE) {
197+
fprintf(stderr, "proxy %s has invalid value or is not numeric\n", host);
198+
exit(1);
199+
}
200+
pd[count].ip.as_int = (uint32_t) host_ip;
196201
pd[count].port = htons((unsigned short) port_n);
197202

198203
if(!strcmp(type, "http")) {

0 commit comments

Comments
 (0)