Make sure that Utility::GlobRecursive doesn't recurse into . and ..

Fixes #5946
This commit is contained in:
Gunnar Beutner 2014-04-05 23:02:48 +02:00 committed by Gunnar Beutner
parent bc4cacfee9
commit 70062b5884
1 changed files with 6 additions and 0 deletions

View File

@ -446,6 +446,9 @@ bool Utility::Glob(const String& pathSpec, const boost::function<void (const Str
} }
do { do {
if (strcmp(wfd.cFileName, ".") == 0 || strcmp(wfd.cFileName, "..") == 0)
continue;
if ((wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && !(type & GlobDirectory)) if ((wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && !(type & GlobDirectory))
continue; continue;
@ -543,6 +546,9 @@ bool Utility::GlobRecursive(const String& path, const String& pattern, const boo
} }
do { do {
if (strcmp(wfd.cFileName, ".") == 0 || strcmp(wfd.cFileName, "..") == 0)
continue;
String cpath = path + "/" + wfd.cFileName; String cpath = path + "/" + wfd.cFileName;
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)