netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: Zero terminate ifr_name in dev_ifname().
@ 2017-07-19 20:34 David Miller
  0 siblings, 0 replies; only message in thread
From: David Miller @ 2017-07-19 20:34 UTC (permalink / raw)
  To: netdev


The ifr.ifr_name is passed around and assumed to be NULL terminated.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/core/dev_ioctl.c | 1 +
 1 file changed, 1 insertion(+)

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)
-- 
2.13.3

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

only message in thread, other threads:[~2017-07-19 20:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-19 20:34 [PATCH] net: Zero terminate ifr_name in dev_ifname() David Miller

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 NNTP newsgroup(s).