aboutsummaryrefslogtreecommitdiff
path: root/sbin/fsck_msdosfs
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2018-07-13 02:02:16 +0000
committerXin LI <delphij@FreeBSD.org>2018-07-13 02:02:16 +0000
commit7f2b7ec93c347ef81cb6048c6895b967feaa2260 (patch)
tree65c1d6b1f96d33d226dc745645dea54d4ef7652f /sbin/fsck_msdosfs
parentbcbc8d35eb309dbec93ba2a95c7ac9809fda1b38 (diff)
downloadsrc-7f2b7ec93c347ef81cb6048c6895b967feaa2260.tar.gz
src-7f2b7ec93c347ef81cb6048c6895b967feaa2260.zip
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
Notes
Notes: svn path=/head/; revision=336236
Diffstat (limited to 'sbin/fsck_msdosfs')
-rw-r--r--sbin/fsck_msdosfs/boot.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sbin/fsck_msdosfs/boot.c b/sbin/fsck_msdosfs/boot.c
index 9a954d07ae9e..9e0958a94544 100644
--- a/sbin/fsck_msdosfs/boot.c
+++ b/sbin/fsck_msdosfs/boot.c
@@ -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) {