#2987 closed defect (fixed)
fat: msdos_dir_read(..) doesn't reset conversion output string length
Reported by: | slemstick | Owned by: | Sebastian Huber |
---|---|---|---|
Priority: | normal | Milestone: | 4.11.3 |
Component: | fs/fat | Version: | 4.11 |
Severity: | normal | Keywords: | |
Cc: | Blocked By: | ||
Blocking: |
Description
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.
Attachments (1)
Change History (10)
Changed on 04/09/17 at 10:33:41 by slemstick
Attachment: | 0001-Fix-issue-that-msdos_dir_read-didn-t-reset-an-output.patch added |
---|
comment:1 Changed on 04/11/17 at 00:43:35 by Gedare Bloom
comment:2 Changed on 05/11/17 at 07:31:02 by Sebastian Huber
Milestone: | 4.12 → 4.12.0 |
---|
comment:3 Changed on 06/12/17 at 07:32:58 by Sebastian Huber
Without a real name I cannot apply this patch.
comment:4 Changed on 08/24/17 at 09:56:36 by Sebastian Huber
Owner: | set to Sebastian Huber |
---|---|
Status: | new → assigned |
comment:5 Changed on 08/24/17 at 10:03:56 by Sebastian Huber
Component: | General → filesystem |
---|---|
Summary: | msdos_dir_read(..) doesn't reset conversion output string length → fat: msdos_dir_read(..) doesn't reset conversion output string length |
comment:7 Changed on 09/06/17 at 11:24:30 by Sebastian Huber
Milestone: | 4.12.0 → 4.11.3 |
---|---|
Version: | 4.12 → 4.11 |
comment:8 Changed on 09/06/17 at 11:24:52 by Sebastian Huber <sebastian.huber@…>
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
In e1c3dc09/rtems:
comment:9 Changed on 10/10/17 at 06:50:58 by Sebastian Huber
Component: | fs → fs/fat |
---|
Please remove the spurious whitespace changes, add "Closes #2987." Into the commit message, and format a friendly short commit message that specifies the rtems subsystem first, e.g. "libfs/dosfs: ..."
Please see Developer/Git?