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 committed Nov 12, 2023
1 parent 97d8e65 commit ba1567f
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 ba1567f

Please sign in to comment.