VFS: Add two assertions to resolve_path() to catch corrupted file systems.

This commit is contained in:
Andreas Kling 2019-02-15 09:07:29 +01:00
parent 18210c606d
commit 0d23cd73e6
Notes: sideshowbarker 2024-07-19 15:42:43 +09:00

View file

@ -477,9 +477,11 @@ InodeIdentifier VFS::resolve_path(const String& path, InodeIdentifier base, int&
#endif
auto mount = find_mount_for_guest(crumb_id);
auto dir_inode = get_inode(mount->host());
ASSERT(dir_inode);
crumb_id = dir_inode->lookup("..");
}
crumb_inode = get_inode(crumb_id);
ASSERT(crumb_inode);
metadata = crumb_inode->metadata();
if (metadata.is_directory()) {
if (i != parts.size() - 1) {