• R/O
  • HTTP
  • SSH
  • HTTPS

linux-2.4.36: Commit

2.4.36-stable kernel tree


Commit MetaInfo

Revisioneb0a06330df97dd9bbaf966cf29d755eff90ecd6 (tree)
Time2007-12-17 08:11:53
AuthorWilly Tarreau <w@1wt....>
CommiterWilly Tarreau

Log Message

[PATCH] isdn: fix isdn_ioctl memory overrun vulnerability

Backport of 2.6 commit eafe1aa37e6ec2d56f14732b5240c4dd09f0613a by Karsten Keil

I4L: fix isdn_ioctl memory overrun vulnerability
Fix possible memory overrun issue in the isdn ioctl code.
Found by ADLAB <adlab@venustech.com.cn>
Signed-off-by: Karsten Keil <kkeil@suse.de>
Cc: ADLAB <adlab@venustech.com.cn>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Signed-off-by: Willy Tarreau <w@1wt.eu>

Change Summary

Incremental Difference

--- a/drivers/isdn/isdn_common.c
+++ b/drivers/isdn/isdn_common.c
@@ -1442,6 +1442,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
14421442 if (copy_from_user((char *) &iocts, (char *) arg,
14431443 sizeof(isdn_ioctl_struct)))
14441444 return -EFAULT;
1445+ iocts.drvid[sizeof(iocts.drvid)-1] = 0;
14451446 if (strlen(iocts.drvid)) {
14461447 if ((p = strchr(iocts.drvid, ',')))
14471448 *p = 0;
@@ -1527,6 +1528,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
15271528 (char *) arg,
15281529 sizeof(isdn_ioctl_struct)))
15291530 return -EFAULT;
1531+ iocts.drvid[sizeof(iocts.drvid)-1] = 0;
15301532 if (strlen(iocts.drvid)) {
15311533 drvidx = -1;
15321534 for (i = 0; i < ISDN_MAX_DRIVERS; i++)
@@ -1571,7 +1573,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
15711573 } else {
15721574 p = (char *) iocts.arg;
15731575 for (i = 0; i < 10; i++) {
1574- sprintf(bname, "%s%s",
1576+ snprintf(bname, sizeof(bname), "%s%s",
15751577 strlen(dev->drv[drvidx]->msn2eaz[i]) ?
15761578 dev->drv[drvidx]->msn2eaz[i] : "_",
15771579 (i < 9) ? "," : "\0");
@@ -1601,6 +1603,7 @@ isdn_ioctl(struct inode *inode, struct file *file, uint cmd, ulong arg)
16011603 char *p;
16021604 if (copy_from_user((char *) &iocts, (char *) arg, sizeof(isdn_ioctl_struct)))
16031605 return -EFAULT;
1606+ iocts.drvid[sizeof(iocts.drvid)-1] = 0;
16041607 if (strlen(iocts.drvid)) {
16051608 if ((p = strchr(iocts.drvid, ',')))
16061609 *p = 0;
Show on old repository browser