about summary refs log tree commit diff
path: root/sysdeps/mach/hurd/if_index.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2018-04-04 00:01:19 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2018-04-04 00:01:19 +0200
commitcd104f4ff43fed06aed9069cf662c4a5bc2ffbc0 (patch)
tree9be5f2ad143064056c3257747763d4e3e6b2ff13 /sysdeps/mach/hurd/if_index.c
parent92846492dc3ae0be25e7ea93daf42b08906068d9 (diff)
downloadglibc-cd104f4ff43fed06aed9069cf662c4a5bc2ffbc0.tar.gz
glibc-cd104f4ff43fed06aed9069cf662c4a5bc2ffbc0.tar.xz
glibc-cd104f4ff43fed06aed9069cf662c4a5bc2ffbc0.zip
hurd: Fix missing trailing NUL in __if_nametoindex
* sysdeps/mach/hurd/if_index.c (__if_nametoindex): Pass the whole buffer
size to strncpy.
Diffstat (limited to 'sysdeps/mach/hurd/if_index.c')
-rw-r--r--sysdeps/mach/hurd/if_index.c2
1 files changed, 1 insertions, 1 deletions
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;