Kernel: Return early in create_inode if name is too long

This commit is contained in:
Luke 2020-09-28 20:50:07 +01:00 committed by Andreas Kling
parent cfa5e6efe9
commit d79194d87f
Notes: sideshowbarker 2024-07-19 02:08:28 +09:00

View file

@ -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