public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [hurd,commited] hurd: Fix missing trailing NUL in __if_nametoindex
@ 2018-04-03 22:02 Samuel Thibault
  0 siblings, 0 replies; only message in thread
From: Samuel Thibault @ 2018-04-03 22:02 UTC (permalink / raw)
  To: libc-alpha; +Cc: Samuel Thibault

* 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(-)

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;
-- 
2.16.2

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-03 22:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-03 22:02 [hurd,commited] hurd: Fix missing trailing NUL in __if_nametoindex Samuel Thibault

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).