Fix off by one error in FAT16 <=> FAT32 detection
authorThomas Frauendorfer <tf@miray.de>
Tue, 5 Mar 2019 16:04:34 +0000 (17:04 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 15 Mar 2019 08:57:24 +0000 (09:57 +0100)
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@miray.de>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
util-linux/volume_id/fat.c

index b24ed098e9caaf1dd4ff6552d2e5e9d28bec98ff..fe37508800057910039c4e5435e9b3b27e736eeb 100644 (file)
@@ -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 */