tst-if_nameindex.c: Fix minimum buffer size

The standard says that the buffer given to if_indextoname shall have at
least IF_NAMESIZE bytes.
This commit is contained in:
Samuel Thibault 2026-01-12 21:23:33 +01:00
parent f05ab7c4a9
commit 274441f62a
1 changed files with 2 additions and 0 deletions

View File

@ -72,6 +72,8 @@ do_test (void)
if (strlen (ifp->if_name) + 1 > buflen)
buflen = strlen (ifp->if_name) + 1;
}
if (buflen < IF_NAMESIZE)
buflen = IF_NAMESIZE;
buffer = (char *) xmalloc (buflen);
/* Check normal operation. */