Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch in CCustomScript::ResolvePath for ModLoader support. #184

Merged
merged 3 commits into from
Sep 10, 2024

Conversation

MiranDMC
Copy link
Collaborator

No description provided.

Copy link

@x87 x87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please delete commented code

@MiranDMC
Copy link
Collaborator Author

please delete commented code

This is that check for safe paths. This should be implemented in correct way instead of just disabling.

@x87 x87 changed the title Patch in CCustomScript::ResolvePath for ModLoater support. Patch in CCustomScript::ResolvePath for ModLoader support. Sep 10, 2024
@x87
Copy link

x87 commented Sep 10, 2024

please delete commented code

This is that check for safe paths. This should be implemented in correct way instead of just disabling.

are you going to update it in this PR?

// does file path points inside game directories? (game root or user files)
static bool IsFilepathSafe(CLEO::CRunningScript* thread, const char* path)
{
// TODO: path handling should use more advanced utils from std::filesystem
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe call canonical first, then check if the path starts with root/userfiles ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but this will need including std::filesystem. I'm not sure if this header should create that dependency.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you move it to a separate header file then?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I'm not familiar with filesystem APIs in C++, so I'm going to trust you that this is working as intended.

@MiranDMC MiranDMC force-pushed the ModLoaded_experiments branch from e09a9b2 to 6bbaff4 Compare September 10, 2024 17:54
@MiranDMC
Copy link
Collaborator Author

MiranDMC commented Sep 10, 2024

@x87
Copy link

x87 commented Sep 10, 2024

This is what it also does in CLEO4, so users should already suffer from it. We can discuss potential mitigation, but it's not our primary concern right now.

@MiranDMC MiranDMC marked this pull request as ready for review September 10, 2024 19:55
@MiranDMC MiranDMC merged commit a02d8d0 into master Sep 10, 2024
1 check passed
@MiranDMC MiranDMC deleted the ModLoaded_experiments branch September 16, 2024 04:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants