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

Fix for filenames of the form "x/../y" #742

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mz_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ int32_t mz_path_resolve(const char *path, char *output, int32_t max_output) {
if ((*check == 0) || (*check == '\\' || *check == '/')) {
source += (check - source);

/* Search backwards for previous slash */
/* Search backwards for previous slash or the start of the output string */
if (target != output) {
target -= 1;
do {
if ((*target == '\\') || (*target == '/'))
if ((target == output) ||(*target == '\\') || (*target == '/'))
break;

target -= 1;
Expand Down