From df965878c72805da41be99b26e41235827f58cc0 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Wed, 15 Jul 2026 12:07:20 +0100 Subject: [PATCH] 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 2d85bba6b9ddd20b74992c740fab7f82c9c03f01 --- src/test/test-nss-hosts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/test-nss-hosts.c b/src/test/test-nss-hosts.c index 61f9b153f8..761677430a 100644 --- a/src/test/test-nss-hosts.c +++ b/src/test/test-nss-hosts.c @@ -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) {