mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-27 23:09:08 +00:00
Kernel: Clarify ambiguous {File,Description}::absolute_path
Found due to smelly code in InodeFile::absolute_path. In particular, this replaces the following misleading methods: File::absolute_path This method *never* returns an actual path, and if called on an InodeFile (which is impossible), it would VERIFY_NOT_REACHED(). OpenFileDescription::try_serialize_absolute_path OpenFileDescription::absolute_path These methods do not guarantee to return an actual path (just like the other method), and just like Custody::absolute_path they do not guarantee accuracy. In particular, just renaming the method made a TOCTOU bug obvious. The new method signatures use KResultOr, just like try_serialize_absolute_path() already did.
This commit is contained in:
parent
88ca12f037
commit
c05c5a7ff4
Notes:
sideshowbarker
2024-07-18 01:43:05 +09:00
Author: https://github.com/BenWiederhake
Commit: c05c5a7ff4
Pull-request: https://github.com/SerenityOS/serenity/pull/10707
28 changed files with 83 additions and 65 deletions
|
@ -30,4 +30,9 @@ KResultOr<Memory::Region*> AnonymousFile::mmap(Process& process, OpenFileDescrip
|
|||
return process.address_space().allocate_region_with_vmobject(range, m_vmobject, offset, {}, prot, shared);
|
||||
}
|
||||
|
||||
KResultOr<NonnullOwnPtr<KString>> AnonymousFile::pseudo_path(const OpenFileDescription&) const
|
||||
{
|
||||
return KString::try_create(":anonymous-file:"sv);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue