Kernel: Reading past the end of an Ext2FSInode should return 0
Fixes #5763.
This commit is contained in:
parent
23cc88f83b
commit
5001b71c42
Notes:
sideshowbarker
2024-07-18 20:49:23 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/5001b71c423
1 changed files with 3 additions and 0 deletions
|
@ -857,6 +857,9 @@ ssize_t Ext2FSInode::read_bytes(off_t offset, ssize_t count, UserOrKernelBuffer&
|
|||
if (m_raw_inode.i_size == 0)
|
||||
return 0;
|
||||
|
||||
if (static_cast<u64>(offset) >= size())
|
||||
return 0;
|
||||
|
||||
// Symbolic links shorter than 60 characters are store inline inside the i_block array.
|
||||
// This avoids wasting an entire block on short links. (Most links are short.)
|
||||
if (is_symlink() && size() < max_inline_symlink_length) {
|
||||
|
|
Loading…
Add table
Reference in a new issue