R0.13b patch 1

May 23, 2018

Reading a directory gets infinite loop.
Successive f_readdir() calls would not detect the end of directory if the directory was filled up
and the last entry is not empty. This problem was reported at the User Forum.
This commit is contained in:
Christopher Williams
2018-07-24 17:46:45 -07:00
parent 9c7d461c41
commit d5cd09ebf7
+2 -1
View File
@@ -1728,7 +1728,8 @@ static FRESULT dir_next ( /* FR_OK(0):succeeded, FR_NO_FILE:End of table, FR_DEN
ofs = dp->dptr + SZDIRE; /* Next entry */
if (dp->sect == 0 || ofs >= (DWORD)((FF_FS_EXFAT && fs->fs_type == FS_EXFAT) ? MAX_DIR_EX : MAX_DIR)) return FR_NO_FILE; /* Report EOT when offset has reached max value */
if (ofs >= (DWORD)((FF_FS_EXFAT && fs->fs_type == FS_EXFAT) ? MAX_DIR_EX : MAX_DIR)) dp->sect = 0; /* Disable it if the offset reached the max value */
if (dp->sect == 0) return FR_NO_FILE; /* Report EOT if it has been disabled */
if (ofs % SS(fs) == 0) { /* Sector changed? */
dp->sect++; /* Next sector */