[git commit] Fix off by one error in FAT16 <=> FAT32 detection

Denys Vlasenko vda.linux at googlemail.com
Fri Mar 15 08:57:24 UTC 2019


commit: https://git.busybox.net/busybox/commit/?id=2bbd1e1e8ababc480ff5d373847ab98ba0cc23dd
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

cluster_count is compared against FAT16_MAX, which is defined as 0xfff4
That is the maximum number of cluster a FAT16 can have.

For reference also check the  hardware whitepaper from Microsoft
FAT: General Overview of On-Disk Format, version 1.03 page 15

Signed-off-by: Thomas Frauendorfer <tf at miray.de>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 util-linux/volume_id/fat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util-linux/volume_id/fat.c b/util-linux/volume_id/fat.c
index b24ed098e..fe3750880 100644
--- a/util-linux/volume_id/fat.c
+++ b/util-linux/volume_id/fat.c
@@ -247,7 +247,7 @@ int FAST_FUNC volume_id_probe_vfat(struct volume_id *id /*,uint64_t fat_partitio
 //		strcpy(id->type_version, "FAT32");
 //		goto fat32;
 //	}
-	if (cluster_count >= FAT16_MAX)
+	if (cluster_count > FAT16_MAX)
 		goto fat32;
 
 	/* the label may be an attribute in the root directory */


More information about the busybox-cvs mailing list