diff options
author | Dann Frazier <dannf@hp.com> | 2007-10-06 23:51:05 +0200 |
---|---|---|
committer | Adrian Bunk <bunk@kernel.org> | 2007-10-06 23:51:05 +0200 |
commit | de9e88d512afbad9f7a5d73b28dbcc332894b81a (patch) | |
tree | f686d35a265aeb61036861b240fef2aa56a4479f /drivers | |
parent | cc6b1c0e31e1f639d3c5e161039c24edb41c4537 (diff) |
fix buffer overflow in the moxa driver (CVE-2005-0504)
Signed-off-by: Dann Frazier <dannf@hp.com>
Signed-off-by: Andres Salomon <dilinger@debian.org>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/char/moxa.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/char/moxa.c b/drivers/char/moxa.c index f43c2e04ead..f9815bf418d 100644 --- a/drivers/char/moxa.c +++ b/drivers/char/moxa.c @@ -1656,7 +1656,7 @@ int MoxaDriverIoctl(unsigned int cmd, unsigned long arg, int port) if(copy_from_user(&dltmp, argp, sizeof(struct dl_str))) return -EFAULT; - if(dltmp.cardno < 0 || dltmp.cardno >= MAX_BOARDS) + if(dltmp.cardno < 0 || dltmp.cardno >= MAX_BOARDS || dltmp.len < 0) return -EINVAL; switch(cmd) @@ -2764,6 +2764,8 @@ static int moxaloadbios(int cardno, unsigned char __user *tmp, int len) void __iomem *baseAddr; int i; + if(len < 0 || len > sizeof(moxaBuff)) + return -EINVAL; if(copy_from_user(moxaBuff, tmp, len)) return -EFAULT; baseAddr = moxaBaseAddr[cardno]; @@ -2811,7 +2813,7 @@ static int moxaload320b(int cardno, unsigned char __user *tmp, int len) void __iomem *baseAddr; int i; - if(len > sizeof(moxaBuff)) + if(len < 0 || len > sizeof(moxaBuff)) return -EINVAL; if(copy_from_user(moxaBuff, tmp, len)) return -EFAULT; @@ -2831,6 +2833,8 @@ static int moxaloadcode(int cardno, unsigned char __user *tmp, int len) void __iomem *baseAddr, *ofsAddr; int retval, port, i; + if(len < 0 || len > sizeof(moxaBuff)) + return -EINVAL; if(copy_from_user(moxaBuff, tmp, len)) return -EFAULT; baseAddr = moxaBaseAddr[cardno]; |