mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-21 10:19:03 +03:00
Kernel-VFS: Fixed kernel crash if parent custody is null
In VFS::rename, if new_path is equal to '/', then, parent custody is set to null. VFS::rename would then use parent custody without checking it first. Fixed VFS::rename to check both old and new path parent custody before actually using them.
This commit is contained in:
parent
90b6f999e5
commit
293a5c2b49
Notes:
sideshowbarker
2024-07-18 18:30:58 +09:00
Author: https://github.com/r-paiva Commit: https://github.com/SerenityOS/serenity/commit/293a5c2b495 Pull-request: https://github.com/SerenityOS/serenity/pull/6899
@ -498,6 +498,10 @@ KResult VFS::rename(StringView old_path, StringView new_path, Custody& base)
|
||||
return new_custody_or_error.error();
|
||||
}
|
||||
|
||||
if (!old_parent_custody || !new_parent_custody) {
|
||||
return EPERM;
|
||||
}
|
||||
|
||||
auto& old_parent_inode = old_parent_custody->inode();
|
||||
auto& new_parent_inode = new_parent_custody->inode();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user