diff options
author | rofl0r <retnyg@gmx.net> | 2013-05-02 15:40:56 +0400 |
---|---|---|
committer | rofl0r <retnyg@gmx.net> | 2013-05-02 15:44:49 +0400 |
commit | 64a7cd26dcb3b4e0a8fab8087b69671f7ddbe248 (patch) | |
tree | 258235b28de855c2e2617a306827c2ad9a2a1d09 | |
parent | 9f6ed6ed90e1e1e230c633c4a194eae8e662b26f (diff) |
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
-rw-r--r-- | src/libproxychains.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libproxychains.c b/src/libproxychains.c index 118c32e..6323d10 100644 --- a/src/libproxychains.c +++ b/src/libproxychains.c @@ -192,7 +192,12 @@ static void get_chain_data(proxy_data * pd, unsigned int *proxy_count, chain_typ sscanf(buff, "%s %s %d %s %s", type, host, &port_n, pd[count].user, pd[count].pass); - pd[count].ip.as_int = (uint32_t) inet_addr(host); + in_addr_t host_ip = inet_addr(host); + if(host_ip == INADDR_NONE) { + fprintf(stderr, "proxy %s has invalid value or is not numeric\n", host); + exit(1); + } + pd[count].ip.as_int = (uint32_t) host_ip; pd[count].port = htons((unsigned short) port_n); if(!strcmp(type, "http")) { |