Ext2FS: Don't copy more than sizeof(ext2_inode) bytes of raw inode data.
Some file systems have inodes larger than sizeof(ext2_inode) so this would stomp all over unrelated data.
This commit is contained in:
parent
a7a456002e
commit
d218686c0a
Notes:
sideshowbarker
2024-07-19 15:38:17 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/d218686c0ad
1 changed files with 1 additions and 1 deletions
|
@ -424,7 +424,7 @@ RetainPtr<Inode> Ext2FS::get_inode(InodeIdentifier inode) const
|
|||
if (it != m_inode_cache.end())
|
||||
return (*it).value;
|
||||
auto new_inode = adopt(*new Ext2FSInode(const_cast<Ext2FS&>(*this), inode.index()));
|
||||
memcpy(&new_inode->m_raw_inode, reinterpret_cast<ext2_inode*>(block.offset_pointer(offset)), inode_size());
|
||||
memcpy(&new_inode->m_raw_inode, reinterpret_cast<ext2_inode*>(block.offset_pointer(offset)), sizeof(ext2_inode));
|
||||
m_inode_cache.set(inode.index(), new_inode.copy_ref());
|
||||
return new_inode;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue