mirror of
git://git.musl-libc.org/musl
synced 2024-12-17 12:14:42 +00:00
return the requested string as the "canonical name" for numeric addresses
previously NULL was returned in ai_canonname, resulting in crashes in some callers. this behavior was incorrect. note however that the new behavior differs from glibc, which performs reverse dns lookups. POSIX is very clear that a reverse DNS lookup must not be performed for numeric addresses.
This commit is contained in:
parent
d4fbebe18d
commit
e2cc0bee11
@ -117,6 +117,7 @@ int getaddrinfo(const char *host, const char *serv, const struct addrinfo *hint,
|
||||
buf->ai.ai_addr = (void *)&buf->sa;
|
||||
buf->ai.ai_addrlen = family==AF_INET6 ? sizeof sa.sin6 : sizeof sa.sin;
|
||||
buf->ai.ai_family = family;
|
||||
buf->ai.ai_canonname = (char *)host;
|
||||
buf->sa = sa;
|
||||
buf->sa.sin.sin_port = port;
|
||||
*res = &buf->ai;
|
||||
|
Loading…
Reference in New Issue
Block a user