From 2a5ed95231e3e661c72e4d0bf2df2eb3f5030d08 Mon Sep 17 00:00:00 2001 From: Christopher Williams Date: Sat, 11 Nov 2017 23:47:54 -0700 Subject: [PATCH] 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. --- source/ff.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/ff.c b/source/ff.c index a0388b4..fa3fffc 100644 --- a/source/ff.c +++ b/source/ff.c @@ -1176,7 +1176,7 @@ DWORD get_fat ( /* 0xFFFFFFFF:Disk error, 1:Internal error, 2..0x7FFFFFFF:Clust break; #if FF_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 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; UINT n, szb; - BYTE *ibuf; + BYTE *ibuf = 0; 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; - BYTE s_hd, e_hd, *p, *buf; = (BYTE*)work; + BYTE s_hd, e_hd, *p, *buf = (BYTE*)work; DSTATUS stat; DWORD sz_disk, sz_part, s_part; FRESULT res;