[hurd,commited] hurd: Fix missing trailing NUL in __if_nametoindex

Message ID 20180403220202.22098-1-samuel.thibault@ens-lyon.org
State New
Headers show
Series
  • [hurd,commited] hurd: Fix missing trailing NUL in __if_nametoindex
Related show

Commit Message

Samuel Thibault April 3, 2018, 10:02 p.m.
* sysdeps/mach/hurd/if_index.c (__if_nametoindex): Pass the whole buffer
size to strncpy.
---
 sysdeps/mach/hurd/if_index.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/sysdeps/mach/hurd/if_index.c b/sysdeps/mach/hurd/if_index.c
index b56bfc7ecd..de859ebc7c 100644
--- a/sysdeps/mach/hurd/if_index.c
+++ b/sysdeps/mach/hurd/if_index.c
@@ -43,7 +43,7 @@  __if_nametoindex (const char *ifname)
       return 0;
     }
 
-  strncpy (ifr.ifr_name, ifname, IFNAMESIZ - 1);
+  strncpy (ifr.ifr_name, ifname, IFNAMESIZ);
   if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0)
     {
       int saved_errno = errno;