From 801ecb019a3b0de6856b71e5fedcc4a5f6855b52 Mon Sep 17 00:00:00 2001 From: David Walters Date: Thu, 12 Apr 2018 12:44:42 +0100 Subject: [PATCH] patch retro_opendir to handle nullptr and empty-string input --- libretro-common/file/retro_dirent.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libretro-common/file/retro_dirent.c b/libretro-common/file/retro_dirent.c index 9c53504732..6c9de40b0b 100644 --- a/libretro-common/file/retro_dirent.c +++ b/libretro-common/file/retro_dirent.c @@ -108,9 +108,13 @@ struct RDIR *retro_opendir(const char *name) #endif struct RDIR *rdir = (struct RDIR*)calloc(1, sizeof(*rdir)); - if (!rdir) + if (!rdir||!name) return NULL; + /* Handle empty string as current dir */ + if (*name==0) + name="."; + #if defined(_WIN32) (void)path_wide; (void)path_local;