test: make NSS IPv4 tuple bounds explicit

gaih_addrtuple.addr has room for an IPv6 address, while IPv4 uses only
the first struct in_addr. Express the remaining range directly in terms
of that type so static analysis can prove the access remains within the
array.

CID#1663899

Follow-up for 2d85bba6b9
This commit is contained in:
Luca Boccassi
2026-07-15 17:51:48 +01:00
parent 7cb8728d59
commit df965878c7
+2 -2
View File
@@ -74,8 +74,8 @@ static void assert_myhostname_gaih_addrtuples(const struct gaih_addrtuple *tuple
for (const struct gaih_addrtuple *it = tuples; it; it = it->next)
if (it->family == AF_INET)
assert_se(memeqzero(
(const uint8_t*) it->addr + FAMILY_ADDRESS_SIZE(AF_INET),
sizeof(it->addr) - FAMILY_ADDRESS_SIZE(AF_INET)));
(const uint8_t*) it->addr + sizeof(struct in_addr),
sizeof(it->addr) - sizeof(struct in_addr)));
}
static void print_struct_hostent(struct hostent *host, const char *canon) {