[RTEMS Project] #2987: msdos_dir_read(..) doesn't reset conversion output string length
RTEMS trac
trac at rtems.org
Sun Apr 9 10:31:41 UTC 2017
#2987: msdos_dir_read(..) doesn't reset conversion output string length
-----------------------+--------------------
Reporter: slemstick | Owner: (none)
Type: defect | Status: new
Priority: normal | Milestone: 4.12
Component: General | Version: 4.12
Severity: normal | Keywords:
-----------------------+--------------------
msdos_dir_read(..) uses a conversion function,
convert_handler->utf16_to_utf8, to convert LFN directory entry names in
utf16 format to utf8.
However, the conversion handler sets the string length of the output utf8
string as well. That variable: **string_size** in msdos_dir_read(..) is
never re-initialised in the search algorithm. When the volume becomes
sufficiently fragmented, de-allocated LFN directory entry checksums will
cause the filename search algorithm to fail, effectively breaking the
current attempt to concatenate directory entry filename chunks, but the
output string size is now much shorter (10 characters, where it should be
**sizeof(tmp_dirent.d_name)**). Consequently, msdos_dir_read(..) will
continue to parse directory entries with a much smaller output string
size.
The end result is that attempts to read file names from a directory will
output truncated file names (for example, readdir() will "work" as normal
but the output filenames are too short). Any attempt to open these
truncated file names will, of course, fail.
--
Ticket URL: <http://devel.rtems.org/ticket/2987>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
More information about the bugs
mailing list