summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--module/elmcan.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/module/elmcan.c b/module/elmcan.c
index 10ca308..538134c 100644
--- a/module/elmcan.c
+++ b/module/elmcan.c
@@ -1273,13 +1273,15 @@ 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:
- if (copy_to_user((void __user *)arg, elm->dev->name, IFNAMSIZ)) {
+ tmp = strnlen(elm->dev->name, IFNAMSIZ - 1) + 1;
+ if (copy_to_user((void __user *)arg, elm->dev->name, tmp)) {
put_elm(elm);
return -EFAULT;
}