Skip to content

Commit

Permalink
Fix for filenames of the form "x/../y"
Browse files Browse the repository at this point in the history
  • Loading branch information
pmqs authored and nmoinvaz committed Nov 13, 2023
1 parent 97d8e65 commit 3920698
Showing 1 changed file with 2 additions and 2 deletions.
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

0 comments on commit 3920698

Please sign in to comment.