mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-21 18:42:53 +00:00
Kernel/FileSystem: Add check of read offset for the FATInode code
Apparently we lacked this important check from the beginning of this piece of code. This check is crucial to ensure we only give back data being related to the FATInode data buffer and nothing beyond it.
This commit is contained in:
parent
6cc5e09c71
commit
9790b81959
Notes:
sideshowbarker
2024-07-17 08:37:36 +09:00
Author: https://github.com/supercomputer7
Commit: 9790b81959
Pull-request: https://github.com/SerenityOS/serenity/pull/17521
Reviewed-by: https://github.com/awesomekling
1 changed files with 3 additions and 0 deletions
|
@ -201,6 +201,9 @@ u32 FATInode::first_cluster() const
|
|||
ErrorOr<size_t> FATInode::read_bytes_locked(off_t offset, size_t size, UserOrKernelBuffer& buffer, OpenFileDescription*) const
|
||||
{
|
||||
dbgln_if(FAT_DEBUG, "FATFS: Reading inode {}: size: {} offset: {}", identifier().index(), size, offset);
|
||||
VERIFY(offset >= 0);
|
||||
if (offset >= m_metadata.size)
|
||||
return 0;
|
||||
|
||||
// FIXME: Read only the needed blocks instead of the whole file
|
||||
auto blocks = TRY(const_cast<FATInode&>(*this).read_block_list());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue