Re: [PATCH] fat: Read buffer overflow

From: OGAWA Hirofumi
Date: Fri Aug 07 2009 - 19:06:34 EST


Roel Kluin <roel.kluin@xxxxxxxxx> writes:

> If len is less or equal to 0, this results in a read of s[-1].
>
> Signed-off-by: Roel Kluin <roel.kluin@xxxxxxxxx>
> ---
> diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
> index 6f27853..114ff6d 100644
> --- a/fs/fat/namei_vfat.c
> +++ b/fs/fat/namei_vfat.c
> @@ -202,6 +202,9 @@ static inline int vfat_is_used_badchars(const wchar_t *s, int len)
> {
> int i;
>
> + if (len <= 0)
> + return -EINVAL;
> +
> for (i = 0; i < len; i++)
> if (vfat_bad_char(s[i]))
> return -EINVAL;

Um..., what case is this possible? vfat_add_entry() checks (len == 0).
And if xlate_to_uni() couldn't convert name, it should return the error.

Thanks.
--
OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/