Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/rofl0r/proxychains-ng.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrofl0r <retnyg@gmx.net>2014-01-22 19:13:20 +0400
committerrofl0r <retnyg@gmx.net>2014-01-22 19:13:20 +0400
commitb76aa653c9089914d16584a16d35dd037ac0fd62 (patch)
treeec4eadbeeb997eb436b2d0aa70827e95bfe7e4b0
parent63ad1b4d7017de09dd247a49849ba148fc8294d3 (diff)
proxy_getaddrinfo: fix case when func was used in lieu of inet_aton
-rw-r--r--src/core.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core.c b/src/core.c
index f307d8e..634f5e4 100644
--- a/src/core.c
+++ b/src/core.c
@@ -825,8 +825,11 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
// printf("proxy_getaddrinfo node %s service %s\n",node,service);
space = calloc(1, sizeof(struct addrinfo_data));
if(!space) goto err1;
-
+
if(node && !inet_aton(node, &((struct sockaddr_in *) &space->sockaddr_space)->sin_addr)) {
+ /* some folks (nmap) use getaddrinfo() with AI_NUMERICHOST to check whether a string
+ containing a numeric ip was passed. we must return failure in that case. */
+ if(hints && (hints->ai_flags & AI_NUMERICHOST)) return EAI_NONAME;
hp = proxy_gethostbyname(node, &ghdata);
if(hp)
memcpy(&((struct sockaddr_in *) &space->sockaddr_space)->sin_addr,
@@ -841,7 +844,7 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
*res = p = &space->addrinfo_space;
assert((size_t)p == (size_t) space);
-
+
p->ai_addr = &space->sockaddr_space;
if(node)
strncpy(space->addr_name, node, sizeof(space->addr_name));
@@ -857,7 +860,7 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
} else {
p->ai_flags = (AI_V4MAPPED | AI_ADDRCONFIG);
}
-
+
goto out;
err2:
free(space);