lkml.org 
[lkml]   [2023]   [Nov]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] squashfs: squashfs_read_data need to check if the length is 0

> On 16/11/2023 03:13 GMT Lizhi Xu <lizhi.xu@windriver.com> wrote:
>
>
> when the length passed in is 0, the subsequent process should be exited.
>

Reproduced and tested.

Reviewed-by: Phillip Lougher (phillip@squashfs.org.uk)

> Reported-by: syzbot+32d3767580a1ea339a81@syzkaller.appspotmail.com
> Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
> ---
> fs/squashfs/block.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
> index 581ce9519339..2dc730800f44 100644
> --- a/fs/squashfs/block.c
> +++ b/fs/squashfs/block.c
> @@ -321,7 +321,7 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length,
> TRACE("Block @ 0x%llx, %scompressed size %d\n", index - 2,
> compressed ? "" : "un", length);
> }
> - if (length < 0 || length > output->length ||
> + if (length <= 0 || length > output->length ||
> (index + length) > msblk->bytes_used) {
> res = -EIO;
> goto out;
> --
> 2.25.1

\
 
 \ /
  Last update: 2023-11-20 14:01    [W:0.232 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site