Skip to content

Commit

Permalink
Fixed IsFilepathSafe util function. (#190)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiranDMC authored Sep 13, 2024
1 parent b099c1c commit d68bec4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cleo_sdk/CLEO_Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ namespace CLEO
// does file path points inside game directories? (game root or user files)
static bool IsFilepathSafe(CLEO::CRunningScript* thread, const char* path)
{
auto IsSubpath = [](std::filesystem::path path, std::filesystem::path base)
auto IsSubpath = [](std::filesystem::path path, std::filesystem::path base)
{
auto relative = std::filesystem::relative(base, path);
return relative.empty() || relative.native()[0] != '.';
auto relative = std::filesystem::relative(path, base);
return !relative.empty() && *relative.begin() != "..";
};

auto fsPath = std::filesystem::path(path);
Expand Down

0 comments on commit d68bec4

Please sign in to comment.