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 <rofl0r@users.noreply.github.com>2019-07-21 16:27:55 +0300
committerrofl0r <rofl0r@users.noreply.github.com>2019-07-21 16:27:55 +0300
commit962373e5c61fbed30f4288fb34f9f0ab1415055e (patch)
tree644481c67df567a3a1138deded75fa553ce9d8b1
parentde4460fbd17e303996c79fc68879dc1918b695f1 (diff)
getaddrinfo: fix behaviour when node is null and !passive
according to the spec, if these 2 conditions hold, the name shall resolve to localhost. closes #292
-rw-r--r--src/core.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core.c b/src/core.c
index a6f39df..0d79c3a 100644
--- a/src/core.c
+++ b/src/core.c
@@ -879,6 +879,10 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
goto err2;
} else if(node) {
af = ((struct sockaddr_in *) &space->sockaddr_space)->sin_family;
+ } else if(!node && !(hints->ai_flags & AI_PASSIVE)) {
+ af = ((struct sockaddr_in *) &space->sockaddr_space)->sin_family = AF_INET;
+ memcpy(&((struct sockaddr_in *) &space->sockaddr_space)->sin_addr,
+ (char[]){127,0,0,1}, 4);
}
if(service) mygetservbyname_r(service, NULL, &se_buf, buf, sizeof(buf), &se);