From 64a7cd26dcb3b4e0a8fab8087b69671f7ddbe248 Mon Sep 17 00:00:00 2001 From: rofl0r Date: Thu, 2 May 2013 13:40:56 +0200 Subject: [PATCH] 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 --- src/libproxychains.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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")) {