R0.13a patch 1

October 27, 2017

File open and directory listing of any file on the exFAT root directory
beyond the cluster boundary can fail with FR_INT_ERR.
This commit is contained in:
Christopher Williams
2017-11-11 23:47:54 -07:00
parent 7ee1f4cc87
commit 2a5ed95231
+3 -3
View File
@@ -1176,7 +1176,7 @@ DWORD get_fat ( /* 0xFFFFFFFF:Disk error, 1:Internal error, 2..0x7FFFFFFF:Clust
break; break;
#if FF_FS_EXFAT #if FF_FS_EXFAT
case FS_EXFAT : case FS_EXFAT :
if (obj->objsize != 0) { if (obj->objsize != 0 || obj->sclust == 0) { /* Object except root dir must have valid data */
DWORD cofs = clst - obj->sclust; /* Offset from start cluster */ DWORD cofs = clst - obj->sclust; /* Offset from start cluster */
DWORD clen = (DWORD)((obj->objsize - 1) / SS(fs)) / fs->csize; /* Number of clusters - 1 */ DWORD clen = (DWORD)((obj->objsize - 1) / SS(fs)) / fs->csize; /* Number of clusters - 1 */
@@ -1648,7 +1648,7 @@ FRESULT dir_clear ( /* Returns FR_OK or FR_DISK_ERR */
{ {
DWORD sect; DWORD sect;
UINT n, szb; UINT n, szb;
BYTE *ibuf; BYTE *ibuf = 0;
if (sync_window(fs) != FR_OK) return FR_DISK_ERR; /* Flush disk access window */ if (sync_window(fs) != FR_OK) return FR_DISK_ERR; /* Flush disk access window */
@@ -5970,7 +5970,7 @@ FRESULT f_fdisk (
) )
{ {
UINT i, n, sz_cyl, tot_cyl, b_cyl, e_cyl, p_cyl; UINT i, n, sz_cyl, tot_cyl, b_cyl, e_cyl, p_cyl;
BYTE s_hd, e_hd, *p, *buf; = (BYTE*)work; BYTE s_hd, e_hd, *p, *buf = (BYTE*)work;
DSTATUS stat; DSTATUS stat;
DWORD sz_disk, sz_part, s_part; DWORD sz_disk, sz_part, s_part;
FRESULT res; FRESULT res;