lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m1k4strd42.fsf@fess.ebiederm.org>
Date:	Tue, 30 Mar 2010 09:25:01 -0700
From:	ebiederm@...ssion.com (Eric W. Biederman)
To:	Dan Carpenter <error27@...il.com>
Cc:	Martin Schwidefsky <schwidefsky@...ibm.com>,
	Heiko Carstens <heiko.carstens@...ibm.com>,
	linux390@...ibm.com, Hans-Joachim Picht <hans@...ux.vnet.ibm.com>,
	Sebastian Ott <sebott@...ux.vnet.ibm.com>,
	linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
	kernel-janitors@...r.kernel.org
Subject: Re: [patch] s390: potential buffer overflow

Dan Carpenter <error27@...il.com> writes:

> "len" hasn't been properly range checked so we shouldn't use it as an
> array offset.  This can only be written to by root but it would still be
> annoying to accidentally write more than 3 characters and corrupt your
> memory.
>
> Signed-off-by: Dan Carpenter <error27@...il.com>
> ---
> I don't have a cross compile environment to compile this.  Sorry.  :/
>
> diff --git a/drivers/s390/char/sclp_async.c b/drivers/s390/char/sclp_async.c
> index f449c69..72c2e90 100644
> --- a/drivers/s390/char/sclp_async.c
> +++ b/drivers/s390/char/sclp_async.c
> @@ -84,7 +84,7 @@ static int proc_handler_callhome(struct ctl_table *ctl, int write,
>  		rc = copy_from_user(buf, buffer, sizeof(buf));
>  		if (rc != 0)
>  			return -EFAULT;
> -		buf[len - 1] = '\0';
> +		buf[sizeof(buf) - 1] = '\0';
>  		if (strict_strtoul(buf, 0, &val) != 0)
>  			return -EINVAL;
>  		if (val != 0 && val != 1)
> @@ -99,6 +99,7 @@ static int proc_handler_callhome(struct ctl_table *ctl, int write,
>  static struct ctl_table callhome_table[] = {
>  	{
>  		.procname	= "callhome",
> +		.maxlen		= 3,
>  		.mode		= 0644,
>  		.proc_handler	= proc_handler_callhome,
>  	},

Setting maxlen won't do any good as proc_handler_callhome doesn't look at it.

Eric

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ