Skip to content
This repository was archived by the owner on Jul 4, 2025. It is now read-only.

Commit 6bb4656

Browse files
authored
fix: prevent unlimited loop due to invalid filename in path (#2155)
1 parent bc1df0f commit 6bb4656

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

engine/repositories/file_fs_repository.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ std::filesystem::path SanitizePath(const std::filesystem::path& user_input,
2222
if (std::filesystem::equivalent(p, abs_base)) {
2323
return resolved_path;
2424
}
25+
if (p == p.parent_path()) { // reached the root directory
26+
break;
27+
}
2528
}
2629
return {};
2730
}

0 commit comments

Comments
 (0)