The standard says that the buffer given to if_indextoname shall have at
least IF_NAMESIZE bytes.
---
inet/tst-if_nameindex.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/inet/tst-if_nameindex.c b/inet/tst-if_nameindex.c
index c14fc64b92..a371dc4fc1 100644
--- a/inet/tst-if_nameindex.c
+++ b/inet/tst-if_nameindex.c
@@ -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. */
--
2.51.0