diff options
| author | Pranav Rajendran <[email protected]> | 2026-08-15 23:01:15 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2026-08-27 15:00:03 -0600 |
| commit | e007b43a272edae8a63ad66f0151ceaf8cf003c1 (patch) | |
| tree | 4ad701c9e6b41fc1f9cfcdb98d99207d64ba0891 /contrib/apps/httpserver/README | |
| parent | fc557ef9fe116b3245265629cf1d3ab4ac7a480c (diff) | |
fs/squashfs: bound the offset returned by sqfs_dir_offset()
Commit 57e0bb7bf00d ("fs/squashfs: add sqfs_dir_offset() error checks")
made sqfs_search_dir() reject negative returns from sqfs_dir_offset(),
but the positive range is still unbounded. Both parts of the returned
offset come from the image: 'offset' is a 16-bit inode field used
verbatim, and the matched metadata block index may be the last one in
m_list, in which case the returned block (j + 1) is one past the end
of the directory table.
The callers use the result to index dirs->dir_table[], which
sqfs_read_directory_table() allocates as m_count metadata blocks, and
then memcpy() a directory header out of it. A crafted image can
therefore read up to 64 KiB past the end of that allocation.
Reject an inode offset that cannot address a decompressed metadata
block, and verify that the resulting directory header lies entirely
within the directory table.
The existing 'offset < 0' test is dropped: 'offset' is assigned from
get_unaligned_le16() and so is never negative, meaning the test never
fired. The new upper bound covers what it was meant to catch.
Fixes: c51006130370 ("fs/squashfs: new filesystem")
Signed-off-by: Pranav Rajendran <[email protected]>
Reviewed-by: Richard Genoud <[email protected]>
Diffstat (limited to 'contrib/apps/httpserver/README')
0 files changed, 0 insertions, 0 deletions
