mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 04:27:12 +02:00
Kernel: Return early in create_inode if name is too long
This commit is contained in:
Notes:
sideshowbarker
2024-07-19 02:08:28 +09:00
Author: https://github.com/Lubrsi Commit: https://github.com/SerenityOS/serenity/commit/d79194d87f8 Pull-request: https://github.com/SerenityOS/serenity/pull/3635 Issue: https://github.com/SerenityOS/serenity/issues/3634 Reviewed-by: https://github.com/awesomekling
@@ -1445,6 +1445,9 @@ KResultOr<NonnullRefPtr<Inode>> Ext2FS::create_inode(InodeIdentifier parent_id,
|
||||
if (static_cast<const Ext2FSInode&>(*parent_inode).m_raw_inode.i_links_count == 0)
|
||||
return KResult(-ENOENT);
|
||||
|
||||
if (name.length() > EXT2_NAME_LEN)
|
||||
return KResult(-ENAMETOOLONG);
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
dbg() << "Ext2FS: Adding inode '" << name << "' (mode " << String::format("%o", mode) << ") to parent directory " << parent_inode->identifier();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user