mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +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:
@@ -41,6 +41,7 @@ FS::DirectoryEntry::DirectoryEntry(const char* n, InodeIdentifier i, u8 ft)
|
||||
, inode(i)
|
||||
, file_type(ft)
|
||||
{
|
||||
ASSERT(name_length < (int)sizeof(name));
|
||||
memcpy(name, n, name_length);
|
||||
name[name_length] = '\0';
|
||||
}
|
||||
@@ -50,6 +51,7 @@ FS::DirectoryEntry::DirectoryEntry(const char* n, int nl, InodeIdentifier i, u8
|
||||
, inode(i)
|
||||
, file_type(ft)
|
||||
{
|
||||
ASSERT(name_length < (int)sizeof(name));
|
||||
memcpy(name, n, nl);
|
||||
name[nl] = '\0';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user