summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2017-07-19 22:33:24 +0200
committerDavid S. Miller <davem@davemloft.net>2017-07-19 22:33:24 +0200
commit63679112c536289826fec61c917621de95ba2ade (patch)
tree579ed94180d17e7422a26c39d9787771bf5c8409 /net
parentwireless: wext: terminate ifr name coming from userspace (diff)
downloadlinux-63679112c536289826fec61c917621de95ba2ade.tar.xz
linux-63679112c536289826fec61c917621de95ba2ade.zip
net: Zero terminate ifr_name in dev_ifname().
The ifr.ifr_name is passed around and assumed to be NULL terminated. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/dev_ioctl.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/core/dev_ioctl.c b/net/core/dev_ioctl.c
index 7657ad6bc13d..06b147d7d9e2 100644
--- a/net/core/dev_ioctl.c
+++ b/net/core/dev_ioctl.c
@@ -28,6 +28,7 @@ static int dev_ifname(struct net *net, struct ifreq __user *arg)
if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
return -EFAULT;
+ ifr.ifr_name[IFNAMSIZ-1] = 0;
error = netdev_get_name(net, ifr.ifr_name, ifr.ifr_ifindex);
if (error)