Use strncpy when populating struct ifreq->ifr_name
We already check that ifname will fit into ifr_name in main(), but in
case do_ifreq gets called from elsewhere, use strncpy() instead of
strcpy().
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
diff --git a/inarp.c b/inarp.c
index 68e99ff..2ef7d41 100644
--- a/inarp.c
+++ b/inarp.c
@@ -114,7 +114,7 @@
const char *ifname, struct ifreq *ifreq)
{
memset(ifreq, 0, sizeof(*ifreq));
- strcpy(ifreq->ifr_name, ifname);
+ strncpy(ifreq->ifr_name, ifname, sizeof(ifreq->ifr_name));
return ioctl(fd, type, ifreq);
}