Commit f236da93 authored by David S. Miller's avatar David S. Miller Committed by Greg Kroah-Hartman

net: Zero terminate ifr_name in dev_ifname().


[ Upstream commit 63679112 ]

The ifr.ifr_name is passed around and assumed to be NULL terminated.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c42851f2
...@@ -28,6 +28,7 @@ static int dev_ifname(struct net *net, struct ifreq __user *arg) ...@@ -28,6 +28,7 @@ static int dev_ifname(struct net *net, struct ifreq __user *arg)
if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
return -EFAULT; return -EFAULT;
ifr.ifr_name[IFNAMSIZ-1] = 0;
error = netdev_get_name(net, ifr.ifr_name, ifr.ifr_ifindex); error = netdev_get_name(net, ifr.ifr_name, ifr.ifr_ifindex);
if (error) if (error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment