Array overflow in au_procfs_plm_write
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
There is an simple array overflow when count = 20 in au_procfs_
static ssize_t au_procfs_
size_t count, loff_t *ppos)
{
...
char buf[3 + sizeof(unsigned long) * 2 + 1];
err = -EACCES;
if (unlikely(
goto out;
err = -EINVAL;
if (unlikely(count > sizeof(buf)))
goto out;
err = copy_from_user(buf, ubuf, count);
if (unlikely(err)) {
err = -EFAULT;
goto out;
}
buf[count] = 0; <----here
...
}
My suggestion for the patch is:
static ssize_t au_procfs_
size_t count, loff_t *ppos)
{
...
char buf[3 + sizeof(unsigned long) * 2 + 1];
err = -EACCES;
if (unlikely(
goto out;
err = -EINVAL;
if (unlikely(count > sizeof(buf)))
goto out;
err = copy_from_user(buf, ubuf, count);
if (unlikely(err)) {
err = -EFAULT;
goto out;
}
--- buf[count] = 0;
+++ buf[count - 1] = 0;
...
}
affects: | ubuntu → linux (Ubuntu) |
Changed in linux (Ubuntu): | |
status: | Expired → Confirmed |
Hey Cascardo, is this one for the kernel team?
Thanks