From: Samuel Thibault Date: Tue, 3 Apr 2018 22:01:19 +0000 (+0200) Subject: hurd: Fix missing trailing NUL in __if_nametoindex X-Git-Tag: glibc-2.28~384 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cd104f4ff43fed06aed9069cf662c4a5bc2ffbc0;p=thirdparty%2Fglibc.git hurd: Fix missing trailing NUL in __if_nametoindex * sysdeps/mach/hurd/if_index.c (__if_nametoindex): Pass the whole buffer size to strncpy. --- diff --git a/sysdeps/mach/hurd/if_index.c b/sysdeps/mach/hurd/if_index.c index b56bfc7ecdd..de859ebc7c4 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;