Author: delphij
Date: Fri Jul 13 02:02:16 2018
New Revision: 336236
URL: https://svnweb.freebsd.org/changeset/base/336236

Log:
  Detect and handle invalid number of FATs
  
  If the number of FATs field in the boot sector is zero, give
  an appropriate error code.
  
  Obtained from:        Android 
https://android.googlesource.com/platform/external/fsck_msdos/+/6c29bbe8d58e6fe8755935a04166ecf82ff31f47%5E%21/
  MFC after:    2 weeks

Modified:
  head/sbin/fsck_msdosfs/boot.c

Modified: head/sbin/fsck_msdosfs/boot.c
==============================================================================
--- head/sbin/fsck_msdosfs/boot.c       Fri Jul 13 00:37:47 2018        
(r336235)
+++ head/sbin/fsck_msdosfs/boot.c       Fri Jul 13 02:02:16 2018        
(r336236)
@@ -87,6 +87,10 @@ readboot(int dosfs, struct bootblock *boot)
                pfatal("Invalid sector size: %u", boot->bpbBytesPerSec);
                return FSFATAL;
        }
+       if (boot->bpbFATs == 0) {
+               pfatal("Invalid number of FATs: %u", boot->bpbFATs);
+               return FSFATAL;
+       }
        if (!boot->bpbRootDirEnts)
                boot->flags |= FAT32;
        if (boot->flags & FAT32) {
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to