Skip to content

Commit

Permalink
isdn/i4l: fix buffer overflow
Browse files Browse the repository at this point in the history
commit 9f5af54 upstream.

This fixes a potential buffer overflow in isdn_net.c caused by an
unbounded strcpy.

[ ISDN seems to be effectively unmaintained, and the I4L driver in
  particular is long deprecated, but in case somebody uses this..
    - Linus ]

Signed-off-by: Jiten Thakkar <[email protected]>
Signed-off-by: Annie Cherkaev <[email protected]>
Cc: Karsten Keil <[email protected]>
Cc: Kees Cook <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
anniecherk authored and gregkh committed Aug 7, 2017
1 parent b756862 commit 7b3a667
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions drivers/isdn/i4l/isdn_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1379,6 +1379,7 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
if (arg) {
if (copy_from_user(bname, argp, sizeof(bname) - 1))
return -EFAULT;
bname[sizeof(bname)-1] = 0;
} else
return -EINVAL;
ret = mutex_lock_interruptible(&dev->mtx);
Expand Down
5 changes: 2 additions & 3 deletions drivers/isdn/i4l/isdn_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -2611,10 +2611,9 @@ isdn_net_newslave(char *parm)
char newname[10];

if (p) {
/* Slave-Name MUST not be empty */
if (!strlen(p + 1))
/* Slave-Name MUST not be empty or overflow 'newname' */
if (strscpy(newname, p + 1, sizeof(newname)) <= 0)
return NULL;
strcpy(newname, p + 1);
*p = 0;
/* Master must already exist */
if (!(n = isdn_net_findif(parm)))
Expand Down

0 comments on commit 7b3a667

Please sign in to comment.