* 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.
This commit is contained in:
Corinna Vinschen
2008-03-08 17:28:40 +00:00
parent 23c6ed0394
commit ca6fd6300a
3 changed files with 44 additions and 17 deletions

View File

@@ -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