forked from Bananymous/banan-os
Kernel: VFS now has max link depth of 100
This commit is contained in:
parent
4d4d0e26a9
commit
633cb4f282
|
@ -98,9 +98,11 @@ namespace Kernel
|
||||||
{
|
{
|
||||||
auto temp = TRY(path.split('/'));
|
auto temp = TRY(path.split('/'));
|
||||||
for (size_t i = 0; i < temp.size(); i++)
|
for (size_t i = 0; i < temp.size(); i++)
|
||||||
TRY(path_parts.push_back(temp[temp.size() - i - 1]));
|
TRY(path_parts.emplace_back(temp[temp.size() - i - 1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_t link_depth = 0;
|
||||||
|
|
||||||
while (!path_parts.empty())
|
while (!path_parts.empty())
|
||||||
{
|
{
|
||||||
const auto& path_part = path_parts.back();
|
const auto& path_part = path_parts.back();
|
||||||
|
@ -165,6 +167,10 @@ namespace Kernel
|
||||||
for (size_t i = 0; i < new_parts.size(); i++)
|
for (size_t i = 0; i < new_parts.size(); i++)
|
||||||
TRY(path_parts.emplace_back(new_parts[new_parts.size() - i - 1]));
|
TRY(path_parts.emplace_back(new_parts[new_parts.size() - i - 1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
link_depth++;
|
||||||
|
if (link_depth > 100)
|
||||||
|
return BAN::Error::from_errno(ELOOP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue