From 0919cd974627290b387f2203321848d613d6622d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 6 May 2019 03:00:25 +0200 Subject: [PATCH] (Legacy Win32) Be more careful with retro_vfs_stat_impl --- libretro-common/file/file_path.c | 7 ++++++- libretro-common/vfs/vfs_implementation.c | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/libretro-common/file/file_path.c b/libretro-common/file/file_path.c index a35c1f5d1d..53f1cced3f 100644 --- a/libretro-common/file/file_path.c +++ b/libretro-common/file/file_path.c @@ -654,7 +654,12 @@ void path_basedir(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])) { diff --git a/libretro-common/vfs/vfs_implementation.c b/libretro-common/vfs/vfs_implementation.c index 2a3972ea82..baca8994b7 100644 --- a/libretro-common/vfs/vfs_implementation.c +++ b/libretro-common/vfs/vfs_implementation.c @@ -832,7 +832,8 @@ int retro_vfs_stat_impl(const char *path, int32_t *size) path_local = utf8_to_local_string_alloc(path); file_info = GetFileAttributes(path_local); - _stat(path_local, &buf); + if (!string_is_empty(path_local)) + _stat(path_local, &buf); if (path_local) free(path_local);