svn commit: r356628 - head/sbin/fsck_msdosfs

Xin LI delphij at FreeBSD.org
Sat Jan 11 03:59:07 UTC 2020


Author: delphij
Date: Sat Jan 11 03:59:06 2020
New Revision: 356628
URL: https://svnweb.freebsd.org/changeset/base/356628

Log:
  Require FAT to occupy at least one sector.
  
  Obtained from:	Android https://r.android.com/1205830
  MFC after:	3 days

Modified:
  head/sbin/fsck_msdosfs/boot.c

Modified: head/sbin/fsck_msdosfs/boot.c
==============================================================================
--- head/sbin/fsck_msdosfs/boot.c	Sat Jan 11 03:18:47 2020	(r356627)
+++ head/sbin/fsck_msdosfs/boot.c	Sat Jan 11 03:59:06 2020	(r356628)
@@ -250,7 +250,7 @@ readboot(int dosfs, struct bootblock *boot)
 		boot->FATsecs = boot->bpbFATsmall;
 	}
 
-	if (boot->FATsecs > UINT32_MAX / boot->bpbFATs) {
+	if (boot->FATsecs < 1 || boot->FATsecs > UINT32_MAX / boot->bpbFATs) {
 		pfatal("Invalid FATs(%u) with FATsecs(%zu)",
 			boot->bpbFATs, (size_t)boot->FATsecs);
 		return FSFATAL;


More information about the svn-src-head mailing list