mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-10 19:30:10 +00:00
hurd: Fix buffer overrun in __if_nametoindex
and building with mainline GCC which reports it. * sysdeps/mach/hurd/if_index.c (__if_nametoindex): Always end ifr.fr_name with a NUL caracter.
This commit is contained in:
parent
e88ecbbfe8
commit
511ed56f2e
@ -1,3 +1,8 @@
|
|||||||
|
2018-04-03 Samuel Thibault <samuel.thibault@ens-lyon.org>
|
||||||
|
|
||||||
|
* sysdeps/mach/hurd/if_index.c (__if_nametoindex): Always end
|
||||||
|
ifr.fr_name with a NUL caracter.
|
||||||
|
|
||||||
2018-04-03 Wilco Dijkstra <wdijkstr@arm.com>
|
2018-04-03 Wilco Dijkstra <wdijkstr@arm.com>
|
||||||
|
|
||||||
* sysdeps/ieee754/dbl-64/s_sin.c (__sin): Cleanup ifdefs.
|
* sysdeps/ieee754/dbl-64/s_sin.c (__sin): Cleanup ifdefs.
|
||||||
|
@ -37,7 +37,9 @@ __if_nametoindex (const char *ifname)
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
strncpy (ifr.ifr_name, ifname, IFNAMSIZ);
|
strncpy (ifr.ifr_name, ifname, IFNAMSIZ - 1);
|
||||||
|
ifr.ifr_name[IFNAMESIZ - 1] = '\0';
|
||||||
|
|
||||||
if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0)
|
if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0)
|
||||||
{
|
{
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
|
Loading…
Reference in New Issue
Block a user