(Legacy Win32) Be more careful with retro_vfs_stat_impl

This commit is contained in:
twinaphex 2019-05-06 03:00:25 +02:00
parent 720ebc6834
commit 0919cd9746
2 changed files with 8 additions and 2 deletions

View File

@ -654,7 +654,12 @@ void path_basedir(char *path)
**/ **/
void path_parent_dir(char *path) void path_parent_dir(char *path)
{ {
size_t len = strlen(path); size_t len = 0;
if (!path)
return;
len = strlen(path);
if (len && path_char_is_slash(path[len - 1])) if (len && path_char_is_slash(path[len - 1]))
{ {

View File

@ -832,7 +832,8 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
path_local = utf8_to_local_string_alloc(path); path_local = utf8_to_local_string_alloc(path);
file_info = GetFileAttributes(path_local); file_info = GetFileAttributes(path_local);
_stat(path_local, &buf); if (!string_is_empty(path_local))
_stat(path_local, &buf);
if (path_local) if (path_local)
free(path_local); free(path_local);