mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-26 14:28:49 +00:00
Ext2FS: Trying to create a too-long directory entry should ENAMETOOLONG
Also added some assertions to DirectoryEntry in case someone tries to instantiate them with names that would overflow the name buffer. DirectoryEntry is a crappy data structure, and the name buffer is also crappy. Added a FIXME about replacing it with something nicer. Before this patch, the DirectoryEntry::name buffer would overflow if you did "touch extremely-long-file-name". Duh. Fixes #538.
This commit is contained in:
parent
ada1f504fd
commit
b9be6b7bb4
Notes:
sideshowbarker
2024-07-19 12:09:54 +09:00
Author: https://github.com/awesomekling
Commit: b9be6b7bb4
3 changed files with 6 additions and 0 deletions
|
@ -767,6 +767,9 @@ KResult Ext2FSInode::add_child(InodeIdentifier child_id, const StringView& name,
|
|||
LOCKER(m_lock);
|
||||
ASSERT(is_directory());
|
||||
|
||||
if (name.length() > EXT2_NAME_LEN)
|
||||
return KResult(-ENAMETOOLONG);
|
||||
|
||||
#ifdef EXT2_DEBUG
|
||||
dbg() << "Ext2FSInode::add_child(): Adding inode " << child_id.index() << " with name '" << name << " and mode " << mode << " to directory " << index();
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue