git: sbin/fsck_msdosfs: Correct off-by-two issue when determining FAT type.

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Sun Jan 12 21:21:00 PST 2020


commit 91d7cc5f18dfdc112b6c0bb856e2217c1ecc0007
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Mon Jan 13 14:13:53 2020 +0900

    sbin/fsck_msdosfs: 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.
    
    from freebsd/freebsd at 27b822d4d61893d02ca0bc7163fa323331c497fe

Summary of changes:
 sbin/fsck_msdosfs/boot.c | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/91d7cc5f18dfdc112b6c0bb856e2217c1ecc0007


-- 
DragonFly BSD source repository


More information about the Commits mailing list