diff options
author | наб <nabijaczleweli@nabijaczleweli.xyz> | 2022-06-07 17:39:04 +0200 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2022-06-08 09:01:43 +0200 |
commit | 6d45c0fe89e6de7d35a991051ec7f9feaaaf3729 (patch) | |
tree | f44894bf93e15c42f0a818fd9348d67daf7d11d0 /libc/inet/encodeh.c | |
parent | 28805243f676e769f7c8035125c9e78bf5606434 (diff) |
inet: gethostid: only accept v4 addresses
getaddrinfo() returns addresses from, at least, ip(7) and ipv6(7),
but _addr() always uses sin_addr from struct sockaddr_in;
we're saved from wild unsoundness (or incompatibility)
by virtue of struct sockaddr_in6 having an always-0 u32 sin6_flowinfo
at the same offset, so we end up returning 0 anyway,
but in a round-about and definitely unintended way
Instead, limit the request to AF_INET, and fall through to the end
early, returning the default id=0
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Diffstat (limited to 'libc/inet/encodeh.c')
0 files changed, 0 insertions, 0 deletions