ruby-changes:24645
From: usa <ko1@a...>
Date: Tue, 14 Aug 2012 16:05:23 +0900 (JST)
Subject: [ruby-changes:24645] usa:r36696 (trunk): * win32/win32.c (check_valid_dir): reject "..." as directory name.
usa 2012-08-14 16:05:12 +0900 (Tue, 14 Aug 2012) New Revision: 36696 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36696 Log: * win32/win32.c (check_valid_dir): reject "..." as directory name. [Bug #6851] Modified files: trunk/ChangeLog trunk/win32/win32.c Index: ChangeLog =================================================================== --- ChangeLog (revision 36695) +++ ChangeLog (revision 36696) @@ -1,3 +1,8 @@ +Tue Aug 14 16:03:31 2012 NAKAMURA Usaku <usa@r...> + + * win32/win32.c (check_valid_dir): reject "..." as directory name. + [Bug #6851] + Tue Aug 14 16:02:51 2012 NAKAMURA Usaku <usa@r...> * test/ruby/test_file_exhaustive.rb Index: win32/win32.c =================================================================== --- win32/win32.c (revision 36695) +++ win32/win32.c (revision 36696) @@ -4556,11 +4556,18 @@ HANDLE fh; WCHAR full[MAX_PATH]; WCHAR *dmy; + WCHAR *p, *q; /* GetFileAttributes() determines "..." as directory. */ /* We recheck it by FindFirstFile(). */ - if (wcsstr(path, L"...") == NULL) + if (!(p = wcsstr(path, L"..."))) 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, */ /* FindFirstFile() returns INVALID_HANDLE_VALUE. */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/