Re: [PATCH] dcssblk.c : Array index 'i' is used before limits check.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 24, 2015 at 7:57 AM, Ameen Ali <ameenali023@xxxxxxxxx> wrote:
> Signed-off-by : Ameen Ali <Ameenali023@xxxxxxxxx>

Can you include some text in the commit message body explaining the
meaning of the change? (For example 'avoid out-of-bounds-read by
checking count before indexing' or something like that?)

Reviewed-by: Kees Cook <keescook@xxxxxxxxxxxx>

Thanks!

-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-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux