Skip to content

Commit 2c9690e

Browse files
mofishzztrini
authored andcommitted
fs/erofs: fix an overflow issue of unmapped extents
Here the size should be `length - skip`, otherwise it could cause the destination buffer overflow. Reported-by: jianqiang wang <[email protected]> Fixes: 65cb730 ("fs/erofs: add lz4 decompression support") Signed-off-by: Jianan Huang <[email protected]> Reviewed-by: Gao Xiang <[email protected]>
1 parent 49c0468 commit 2c9690e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/erofs/data.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ static int z_erofs_read_data(struct erofs_inode *inode, char *buffer,
313313
}
314314

315315
if (!(map.m_flags & EROFS_MAP_MAPPED)) {
316-
memset(buffer + end - offset, 0, length);
316+
memset(buffer + end - offset, 0, length - skip);
317317
end = map.m_la;
318318
continue;
319319
}

0 commit comments

Comments
 (0)