HomeFreeBSD

Correct off-by-two issue when determining FAT type.

Description

Correct off-by-two issue when determining FAT type.

In the code we used NumClusters as the upper (non-inclusive) boundary
of valid cluster number, so the actual value was 2 (CLUST_FIRST) more
than the real number of clusters. This causes a FAT16 media with
65524 clusters be treated as FAT32 and might affect FAT12 media with
4084 clusters as well.

To fix this, we increment NumClusters by CLUST_FIRST after the type
determination.

PR: 243179
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D23082

Details

Committed
delphijJan 11 2020, 5:41 PM
Differential Revision
D23082: sbin/fsck_msdosfs: Correct off-by-two issue when determining FAT type.
Parents
rS356635: Fix warning after r356634
Branches
Unknown
Tags
Unknown