Skip to content

Commit

Permalink
Check for zero length path in mz_path_has_slash
Browse files Browse the repository at this point in the history
Fix for #739
  • Loading branch information
pmqs authored and nmoinvaz committed Nov 13, 2023
1 parent 42b6b89 commit 3417608
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mz_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int32_t mz_path_remove_slash(char *path) {

int32_t mz_path_has_slash(const char *path) {
int32_t path_len = (int32_t)strlen(path);
if (path[path_len - 1] != '\\' && path[path_len - 1] != '/')
if (path_len > 0 && path[path_len - 1] != '\\' && path[path_len - 1] != '/')
return MZ_EXIST_ERROR;
return MZ_OK;
}
Expand Down

0 comments on commit 3417608

Please sign in to comment.