[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4A1483E0.1030303@schaufler-ca.com>
Date: Wed, 20 May 2009 15:27:44 -0700
From: Casey Schaufler <casey@...aufler-ca.com>
To: Roel Kluin <roel.kluin@...il.com>
CC: jmorris@...ei.org, lkml <linux-kernel@...r.kernel.org>,
linux-security-module@...r.kernel.org,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] smack:beyond ARRAY_SIZE of data
Roel Kluin wrote:
> Do not go beyond ARRAY_SIZE of data
>
> Signed-off-by: Roel Kluin <roel.kluin@...il.com>
> ---
> diff --git a/security/smack/smackfs.c b/security/smack/smackfs.c
> index e03a7e1..7407e5c 100644
> --- a/security/smack/smackfs.c
> +++ b/security/smack/smackfs.c
> @@ -797,7 +797,7 @@ static ssize_t smk_write_netlbladdr(struct file *file, const char __user *buf,
> return -EPERM;
> if (*ppos != 0)
> return -EINVAL;
> - if (count < SMK_NETLBLADDRMIN || count > SMK_NETLBLADDRMAX)
> + if (count < SMK_NETLBLADDRMIN || count >= SMK_NETLBLADDRMAX)
>
There is a problem here, but this won't fix it. The buffer needs to be
allocated bigger than the potential contents (should be
SMK_NETLBLADDRMAX + 1 instead of SMK_NETLBLADDRMAX. Your patch will clip
the last byte off of a maximum length specification.
> return -EINVAL;
> if (copy_from_user(data, buf, count) != 0)
> return -EFAULT;
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-security-module" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists