1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 23:42:13 +00:00

Kernel: Use LexicalPath to avoid two consecutive slashes in unveil path

This patch fixes a bug in the unveil syscall where an UnveilNode's path
would start with two slashes if it's parent node was "/".
This commit is contained in:
Max Wipfli 2021-06-06 19:19:59 +02:00 committed by Andreas Kling
parent 68ce69db88
commit 9d41dd2ed0

View file

@ -105,7 +105,10 @@ KResultOr<int> Process::sys$unveil(Userspace<const Syscall::SC_unveil_params*> u
it,
lexical_path.parts().end(),
{ new_unveiled_path, (UnveilAccess)new_permissions, true },
[](auto& parent, auto& it) -> Optional<UnveilMetadata> { return UnveilMetadata { String::formatted("{}/{}", parent.path(), *it), parent.permissions(), false, parent.permissions_inherited_from_root() }; });
[](auto& parent, auto& it) -> Optional<UnveilMetadata> {
auto path = LexicalPath::join(parent.path(), *it).string();
return UnveilMetadata { path, parent.permissions(), false, parent.permissions_inherited_from_root() };
});
VERIFY(m_veil_state != VeilState::Locked);
m_veil_state = VeilState::Dropped;
return 0;