Skip to content

Commit 7b3a667

Browse files
anniecherkgregkh
authored andcommitted
isdn/i4l: fix buffer overflow
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]>
1 parent b756862 commit 7b3a667

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/isdn/i4l/isdn_common.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1379,6 +1379,7 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg)
13791379
if (arg) {
13801380
if (copy_from_user(bname, argp, sizeof(bname) - 1))
13811381
return -EFAULT;
1382+
bname[sizeof(bname)-1] = 0;
13821383
} else
13831384
return -EINVAL;
13841385
ret = mutex_lock_interruptible(&dev->mtx);

drivers/isdn/i4l/isdn_net.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2611,10 +2611,9 @@ isdn_net_newslave(char *parm)
26112611
char newname[10];
26122612

26132613
if (p) {
2614-
/* Slave-Name MUST not be empty */
2615-
if (!strlen(p + 1))
2614+
/* Slave-Name MUST not be empty or overflow 'newname' */
2615+
if (strscpy(newname, p + 1, sizeof(newname)) <= 0)
26162616
return NULL;
2617-
strcpy(newname, p + 1);
26182617
*p = 0;
26192618
/* Master must already exist */
26202619
if (!(n = isdn_net_findif(parm)))

0 commit comments

Comments
 (0)