** Changed in: linux (Ubuntu)
       Status: Expired => Confirmed

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/1951927

Title:
  Array overflow in au_procfs_plm_write

Status in linux package in Ubuntu:
  Confirmed

Bug description:
  There is an simple array overflow when count = 20 in
  au_procfs_plm_write.

  static ssize_t au_procfs_plm_write(struct file *file, const char __user *ubuf,
                                   size_t count, loff_t *ppos)
  {
  ...
        char buf[3 + sizeof(unsigned long) * 2 + 1];

        err = -EACCES;
        if (unlikely(!capable(CAP_SYS_ADMIN)))
                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_plm_write(struct file *file, const char __user *ubuf,
                                   size_t count, loff_t *ppos)
  {
  ...
        char buf[3 + sizeof(unsigned long) * 2 + 1];

        err = -EACCES;
        if (unlikely(!capable(CAP_SYS_ADMIN)))
                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;

  ...
  }

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1951927/+subscriptions


-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to