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: <CAGXu5jK7xE0xbT+Q-w4ii1vtLZo2-7J9uKLGdFxgvw15TWHukg@mail.gmail.com>
Date:	Tue, 24 Feb 2015 08:44:28 -0800
From:	Kees Cook <keescook@...omium.org>
To:	Ameen Ali <ameenali023@...il.com>
Cc:	Martin Schwidefsky <schwidefsky@...ibm.com>,
	Heiko Carstens <heiko.carstens@...ibm.com>,
	linux390@...ibm.com, Wolfram Sang <wsa@...-dreams.de>,
	linux-s390@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] dcssblk.c : Array index 'i' is used before limits check.

On Tue, Feb 24, 2015 at 8:41 AM, Ameen Ali <ameenali023@...il.com> wrote:
> avoid out-of-bounds-read by checking count before indexing.
>
> Signed-off-by : Ameen Ali <Ameenali023@...il.com>

Reviewed-by: Kees Cook <keescook@...omium.org>

-Kees

> ---
>  drivers/s390/block/dcssblk.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
> index 96128cb..da21281 100644
> --- a/drivers/s390/block/dcssblk.c
> +++ b/drivers/s390/block/dcssblk.c
> @@ -547,7 +547,7 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
>          * parse input
>          */
>         num_of_segments = 0;
> -       for (i = 0; ((buf[i] != '\0') && (buf[i] != '\n') && i < count); i++) {
> +       for (i = 0; (i < count && (buf[i] != '\0') && (buf[i] != '\n')); i++) {
>                 for (j = i; (buf[j] != ':') &&
>                         (buf[j] != '\0') &&
>                         (buf[j] != '\n') &&
> --
> 2.1.0
>



-- 
Kees Cook
Chrome OS Security
--
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