From ca6fd6300ac6e4d4346c7a0ebd29931d5756b427 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 8 Mar 2008 17:28:40 +0000 Subject: * fhandler_disk_file.cc (DIR_BUF_SIZE): Define required space for file name in terms of sizeof(WCHAR). (fhandler_disk_file::readdir_helper): Convert *all* of fname. * path.cc (fillout_mntent): Use tmp_pathbuf for path buffer. (symlink_worker): Ditto. (SCAN_JUSTCHECKTHIS): New state for suffix_scan to define that only the actual name gets cheked and a suffix is never attached. (suffix_scan::has): If filename + suffix would be > NAME_MAX, start in SCAN_JUSTCHECKTHIS state. (suffix_scan::next): Add case for SCAN_JUSTCHECKTHIS. (symlink_info::check): Use tmp_pathbuf for path buffer. Goto file_not_symlink in case of invalid file name. (realpath): Use tmp_pathbuf for path buffer. --- winsup/cygwin/fhandler_disk_file.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/fhandler_disk_file.cc') diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index fbd66e2ff..e364d9f49 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1542,7 +1542,7 @@ fhandler_disk_file::rmdir () #define DIR_BUF_SIZE (DIR_NUM_ENTRIES \ * (sizeof (FILE_ID_BOTH_DIR_INFORMATION) \ - + 2 * (NAME_MAX + 1))) + + (NAME_MAX + 1) * sizeof (WCHAR))) struct __DIR_cache { @@ -1786,7 +1786,8 @@ fhandler_disk_file::readdir_helper (DIR *dir, dirent *de, DWORD w32_err, } char tmp[NAME_MAX + 1]; - sys_wcstombs (tmp, NAME_MAX, fname->Buffer, fname->Length / sizeof (WCHAR)); + sys_wcstombs (tmp, NAME_MAX + 1, fname->Buffer, + fname->Length / sizeof (WCHAR)); if (pc.isencoded ()) fnunmunge (de->d_name, tmp); else -- cgit v1.2.3