diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2013-03-09 08:08:31 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2013-03-09 08:08:31 +0000 |
commit | 6da1677bc33608eddb87b65b86dfc5881dd6c6e8 (patch) | |
tree | 7826bb90d7cf17cf9d3005bc8c2f9b9f03ab399d /Bootloaders/Incomplete/MassStorage | |
parent | 7f5dab4f261e08972d3f31512c970c29e54707d1 (diff) | |
download | lufa-6da1677bc33608eddb87b65b86dfc5881dd6c6e8.tar.gz lufa-6da1677bc33608eddb87b65b86dfc5881dd6c6e8.tar.bz2 lufa-6da1677bc33608eddb87b65b86dfc5881dd6c6e8.zip |
Fix off-by-one in the VirtualFAT cluster chain generator.
Diffstat (limited to 'Bootloaders/Incomplete/MassStorage')
-rw-r--r-- | Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c | 2 | ||||
-rw-r--r-- | Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c b/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c index 883586c3d..7a248d87e 100644 --- a/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c +++ b/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.c @@ -114,7 +114,7 @@ static void ReadBlock(uint16_t BlockNumber) } /* Mark last cluster as end of file */ - ((uint16_t*)&BlockBuffer)[FILE_CLUSTERS(2049) + 3] = 0xFFFF; + ((uint16_t*)&BlockBuffer)[FILE_CLUSTERS(2049) + 1] = 0xFFFF; break; case 3: diff --git a/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.h b/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.h index 156760afd..98ea5cdd9 100644 --- a/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.h +++ b/Bootloaders/Incomplete/MassStorage/Lib/VirtualFAT.h @@ -39,11 +39,11 @@ /* Macros: */ #define FIRMWARE_FILE_SIZE (FLASHEND + 1UL) - #define FILE_CLUSTERS(size) ((size / CLUSTER_SIZE_BYTES) + ((size % CLUSTER_SIZE_BYTES) ? 1 : 0)) #define SECTOR_SIZE_BYTES 512 #define SECTOR_PER_CLUSTER 4 #define CLUSTER_SIZE_BYTES (SECTOR_PER_CLUSTER * SECTOR_SIZE_BYTES) + #define FILE_CLUSTERS(size) ((size / CLUSTER_SIZE_BYTES) + ((size % CLUSTER_SIZE_BYTES) ? 1 : 0)) #define LUN_MEDIA_BLOCKS ((FIRMWARE_FILE_SIZE / SECTOR_SIZE_BYTES) + 32) |