mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-29 11:41:21 +03:00
Check length of ifname before copying it into to ifreq structure.
[BZ #22442] * sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex): Check if ifname is too long.
This commit is contained in:
@ -1,3 +1,9 @@
|
|||||||
|
2017-11-15 Steve Ellcey <sellcey@cavium.com>
|
||||||
|
|
||||||
|
[BZ #22442]
|
||||||
|
* sysdeps/unix/sysv/linux/if_index.c (__if_nametoindex):
|
||||||
|
Check if ifname is too long.
|
||||||
|
|
||||||
2017-11-15 Luke Shumaker <lukeshu@parabola.nu>
|
2017-11-15 Luke Shumaker <lukeshu@parabola.nu>
|
||||||
|
|
||||||
* sysdeps/unix/sysv/linux/epoll_wait.c: Include <sysdep-cancel.h>.
|
* sysdeps/unix/sysv/linux/epoll_wait.c: Include <sysdep-cancel.h>.
|
||||||
|
@ -43,6 +43,12 @@ __if_nametoindex (const char *ifname)
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
if (strlen (ifname) >= IFNAMSIZ)
|
||||||
|
{
|
||||||
|
__set_errno (ENODEV);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
|
strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
|
||||||
if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0)
|
if (__ioctl (fd, SIOCGIFINDEX, &ifr) < 0)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user