The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sysctl: fix binary sysctl overflow
Date: Fri, 04 Feb 2011 13:09:38 -0800	[thread overview]
Message-ID: <m11v3nik19.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <1296851935-6909-1-git-send-email-lucian.grijincu@gmail.com> (Lucian Adrian Grijincu's message of "Fri, 4 Feb 2011 22:38:55 +0200")

Lucian Adrian Grijincu <lucian.grijincu@gmail.com> writes:

> We allocated a vector of CTL_MAXNAME elements and considered
> [0, CTL_MAXNAME] as valid indexes in the vector.
>
> This fixes valid index range to be [0, CTL_MAXNAME).
>
> I guess this should be backported to stable trees too.

No.  This part of the code is correct.  0 is a valid index,
and the array is only CTL_MAXNAME entries long.

I think the maximum depth of this table is only about 6, but
feel free to count and tell me CTL_MAXNAME is set too low.

Eric


>
> Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
> ---
>  kernel/sysctl_binary.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/kernel/sysctl_binary.c b/kernel/sysctl_binary.c
> index b875bed..e2f377c 100644
> --- a/kernel/sysctl_binary.c
> +++ b/kernel/sysctl_binary.c
> @@ -1446,7 +1446,7 @@ static ssize_t do_sysctl(int __user *args_name, int nlen,
>  	int i;
>  
>  	/* Check args->nlen. */
> -	if (nlen < 0 || nlen > CTL_MAXNAME)
> +	if (nlen < 0 || nlen >= CTL_MAXNAME)
>  		return -ENOTDIR;
>  	/* Read in the sysctl name for simplicity */
>  	for (i = 0; i < nlen; i++)

  reply	other threads:[~2011-02-04 21:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-04 20:38 [PATCH] sysctl: fix binary sysctl overflow Lucian Adrian Grijincu
2011-02-04 21:09 ` Eric W. Biederman [this message]
2011-02-04 21:30   ` Lucian Adrian Grijincu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m11v3nik19.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucian.grijincu@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox