From 81b48e2ebfec83fb0a6daf7fad7a767d57fb1337 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Tue, 7 May 2019 05:25:56 -0700 Subject: [PATCH] SCP: Fix potential crash with mixed path separators on Windows --- sim_fio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sim_fio.c b/sim_fio.c index 44eecafd..cc43e2c8 100644 --- a/sim_fio.c +++ b/sim_fio.c @@ -882,7 +882,8 @@ if ((hFind = FindFirstFileA (cptr, &File)) != INVALID_HANDLE_VALUE) { GetFullPathNameA(cptr, sizeof(DirName), DirName, (char **)&c); c = strrchr (DirName, '\\'); *c = '\0'; /* Truncate to just directory path */ - if (!pathsep || (!strcmp (slash, "/*"))) /* Separator wasn't mentioned? */ + if (!pathsep || /* Separator wasn't mentioned? */ + (slash && (0 == strcmp (slash, "/*")))) pathsep = "\\"; /* Default to Windows backslash */ if (*pathsep == '/') { /* If slash separator? */ while ((c = strchr (DirName, '\\')))