1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 00:47:36 +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:
Andreas Kling 2019-09-10 21:04:27 +02:00
parent ada1f504fd
commit b9be6b7bb4
3 changed files with 6 additions and 0 deletions

View file

@ -47,6 +47,7 @@ public:
virtual KResult prepare_to_unmount() const { return KSuccess; }
// FIXME: This data structure is very clunky and unpleasant. Replace it with something nicer.
struct DirectoryEntry {
DirectoryEntry(const char* name, InodeIdentifier, u8 file_type);
DirectoryEntry(const char* name, int name_length, InodeIdentifier, u8 file_type);