mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2024-12-22 20:38:49 +00:00
proxy_getaddrinfo: fix segfault when hints is NULL
This commit is contained in:
parent
40edf758ee
commit
037edbcb8e
@ -878,10 +878,16 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
|
|||||||
(*res)->ai_canonname = space->addr_name;
|
(*res)->ai_canonname = space->addr_name;
|
||||||
(*res)->ai_next = NULL;
|
(*res)->ai_next = NULL;
|
||||||
(*res)->ai_family = space->sockaddr_space.sa_family = AF_INET;
|
(*res)->ai_family = space->sockaddr_space.sa_family = AF_INET;
|
||||||
|
(*res)->ai_addrlen = sizeof(space->sockaddr_space);
|
||||||
|
|
||||||
|
if(hints) {
|
||||||
(*res)->ai_socktype = hints->ai_socktype;
|
(*res)->ai_socktype = hints->ai_socktype;
|
||||||
(*res)->ai_flags = hints->ai_flags;
|
(*res)->ai_flags = hints->ai_flags;
|
||||||
(*res)->ai_protocol = hints->ai_protocol;
|
(*res)->ai_protocol = hints->ai_protocol;
|
||||||
(*res)->ai_addrlen = sizeof(space->sockaddr_space);
|
} else {
|
||||||
|
(*res)->ai_flags = (AI_V4MAPPED | AI_ADDRCONFIG);
|
||||||
|
}
|
||||||
|
|
||||||
goto out;
|
goto out;
|
||||||
err2:
|
err2:
|
||||||
free(space);
|
free(space);
|
||||||
|
Loading…
Reference in New Issue
Block a user