1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:48:14 +00:00

Kernel: Don't assume there are no nodes if m_unveiled_paths.is_empty()

If m_unveiled_paths.is_empty(), the root node (which is m_unveiled_paths
itself) is the matching veil. This means we should not return nullptr in
this case, but just use the code path for the general case.

This fixes a bug where calling e.g. unveil("/", "r") would refuse you
access to anything, because find_matching_unveiled_path would wrongly
return nullptr.

Since find_matching_unveiled_path can no longer return nullptr, we can
now just return a reference instead.
This commit is contained in:
Max Wipfli 2021-06-06 23:13:26 +02:00 committed by Andreas Kling
parent 8930db0900
commit c1de46aaaf
2 changed files with 12 additions and 14 deletions

View file

@ -102,7 +102,7 @@ public:
private:
friend class FileDescription;
const UnveilNode* find_matching_unveiled_path(StringView path);
UnveilNode const& find_matching_unveiled_path(StringView path);
KResult validate_path_against_process_veil(StringView path, int options);
bool is_vfs_root(InodeIdentifier) const;