mirror of
https://github.com/rofl0r/proxychains-ng
synced 2025-01-08 22:22:52 +08:00
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
This commit is contained in:
parent
de4460fbd1
commit
962373e5c6
@ -879,6 +879,10 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
|
|||||||
goto err2;
|
goto err2;
|
||||||
} else if(node) {
|
} else if(node) {
|
||||||
af = ((struct sockaddr_in *) &space->sockaddr_space)->sin_family;
|
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);
|
if(service) mygetservbyname_r(service, NULL, &se_buf, buf, sizeof(buf), &se);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user