]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: Fix missing trailing NUL in __if_nametoindex
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Tue, 3 Apr 2018 22:01:19 +0000 (00:01 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Tue, 3 Apr 2018 22:01:19 +0000 (00:01 +0200)
* sysdeps/mach/hurd/if_index.c (__if_nametoindex): Pass the whole buffer
size to strncpy.

sysdeps/mach/hurd/if_index.c

index b56bfc7ecdd358886d38552289f67ae449283553..de859ebc7c4e08b94656ca9653b5f6186f93cbbb 100644 (file)
@@ -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;