From 512530c65317ef6736732e745c9c56c8565b08f1 Mon Sep 17 00:00:00 2001 From: Alexander Batalov Date: Fri, 23 Dec 2022 10:33:16 +0300 Subject: [PATCH] Fix building file list on non-Windows platforms --- src/db.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/db.cc b/src/db.cc index 07b2fcd..09bf09a 100644 --- a/src/db.cc +++ b/src/db.cc @@ -645,13 +645,14 @@ int fileNameListInit(const char* pattern, char*** fileNameListPtr, int a3, int a bool isWildcard = *pattern == '*'; for (int index = 0; index < fileNamesLength; index += 1) { - const char* name = xlist->fileNames[index]; + char* name = xlist->fileNames[index]; char dir[COMPAT_MAX_DIR]; char fileName[COMPAT_MAX_FNAME]; char extension[COMPAT_MAX_EXT]; + compat_windows_path_to_native(name); compat_splitpath(name, NULL, dir, fileName, extension); - if (!isWildcard || *dir == '\0' || strchr(dir, '\\') == NULL) { + if (!isWildcard || *dir == '\0' || (strchr(dir, '\\') == NULL && strchr(dir, '/') == NULL)) { // NOTE: Quick and dirty fix to buffer overflow. See RE to // understand the problem. char path[COMPAT_MAX_PATH];