summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--win/tclWinFile.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/win/tclWinFile.c b/win/tclWinFile.c
index 18b05d6..7638ef2 100644
--- a/win/tclWinFile.c
+++ b/win/tclWinFile.c
@@ -1538,15 +1538,26 @@ NativeAccess(
*/
WIN32_FIND_DATA ffd;
- HANDLE hFind;
- hFind = FindFirstFile(nativePath, &ffd);
- if (hFind != INVALID_HANDLE_VALUE) {
- attr = ffd.dwFileAttributes;
- FindClose(hFind);
- } else {
+ HANDLE hFind = FindFirstFile(nativePath, &ffd);
+
+ if (hFind == INVALID_HANDLE_VALUE) {
TclWinConvertError(GetLastError());
return -1;
}
+
+ attr = ffd.dwFileAttributes;
+ FindClose(hFind);
+
+ /*
+ * Take care! Some characters are illegal in a filename, but legal in
+ * a search for a filename because they are wildcards. If there's one
+ * of those, we are still in an error case! [Bug 3608360]
+ */
+
+ if (_tcspbrk(nativePath, _T("?*")) != NULL) {
+ Tcl_SetErrno(EEXIST);
+ return -1;
+ }
}
if (mode == F_OK) {