diff options
author | norly <ny-git@enpas.org> | 2019-02-19 20:19:53 +0100 |
---|---|---|
committer | norly <ny-git@enpas.org> | 2019-02-19 20:19:53 +0100 |
commit | 7b1cd7413d32e591dac47058721c548080257cfb (patch) | |
tree | 3feb7edfad71dc3aa74807af8fc734b02152b849 | |
parent | 744e0f3efe073d2551ffa551f674bd5be44e4296 (diff) |
Always copy IFNAMSIZ bytes on ioctl(SIOCGIFNAME)
Just in case dev->name is ever not NUL terminated
-rw-r--r-- | module/elmcan.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/module/elmcan.c b/module/elmcan.c index abdf8b5..10ca308 100644 --- a/module/elmcan.c +++ b/module/elmcan.c @@ -1273,15 +1273,13 @@ static int elmcan_ldisc_ioctl(struct tty_struct *tty, struct file *file, unsigned int cmd, unsigned long arg) { struct elmcan *elm = get_elm(tty); - unsigned int tmp; if (!elm) return -EINVAL; switch (cmd) { case SIOCGIFNAME: - tmp = strlen(elm->dev->name) + 1; - if (copy_to_user((void __user *)arg, elm->dev->name, tmp)) { + if (copy_to_user((void __user *)arg, elm->dev->name, IFNAMSIZ)) { put_elm(elm); return -EFAULT; } |