* win32/win32.c (check_valid_dir): reject "..." as directory name.
[Bug #6851] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
104b5c7810
commit
cb4e2b590e
@ -1,3 +1,8 @@
|
|||||||
|
Tue Aug 14 16:03:31 2012 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
|
* win32/win32.c (check_valid_dir): reject "..." as directory name.
|
||||||
|
[Bug #6851]
|
||||||
|
|
||||||
Tue Aug 14 16:02:51 2012 NAKAMURA Usaku <usa@ruby-lang.org>
|
Tue Aug 14 16:02:51 2012 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* test/ruby/test_file_exhaustive.rb
|
* test/ruby/test_file_exhaustive.rb
|
||||||
|
@ -4556,11 +4556,18 @@ check_valid_dir(const WCHAR *path)
|
|||||||
HANDLE fh;
|
HANDLE fh;
|
||||||
WCHAR full[MAX_PATH];
|
WCHAR full[MAX_PATH];
|
||||||
WCHAR *dmy;
|
WCHAR *dmy;
|
||||||
|
WCHAR *p, *q;
|
||||||
|
|
||||||
/* GetFileAttributes() determines "..." as directory. */
|
/* GetFileAttributes() determines "..." as directory. */
|
||||||
/* We recheck it by FindFirstFile(). */
|
/* We recheck it by FindFirstFile(). */
|
||||||
if (wcsstr(path, L"...") == NULL)
|
if (!(p = wcsstr(path, L"...")))
|
||||||
return 0;
|
return 0;
|
||||||
|
q = p + wcsspn(p, L".");
|
||||||
|
if ((p == path || wcschr(L":/\\", *(p - 1))) &&
|
||||||
|
(!*q || wcschr(L":/\\", *q))) {
|
||||||
|
errno = ENOENT;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
/* if the specified path is the root of a drive and the drive is empty, */
|
/* if the specified path is the root of a drive and the drive is empty, */
|
||||||
/* FindFirstFile() returns INVALID_HANDLE_VALUE. */
|
/* FindFirstFile() returns INVALID_HANDLE_VALUE. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user