Skip to content

getaddrinfo: use default hints when none supplied

Jim Newsome requested to merge jnewsome/torsocks:hintless into main

Previously we fell back to libc's getaddrinfo when hints is NULL, under the mistaken assumption that the default address family AF_UNSPEC would guarantee it wouldn't look up any address. It's actually the opposite - it means v4 and v6 are both acceptable.

On my machine, with the previous behavior, the native call to getaddrinfo makes an interceptible call to socket to create a UDP socket which we block, preventing a leak, but it's possible with other libc's this could have caused a leak.

With this change such calls can still potentially succeed and return addresses, resolved via tor.

Merge request reports