diff options
author | Xin LI <delphij@FreeBSD.org> | 2018-07-13 02:02:16 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2018-07-13 02:02:16 +0000 |
commit | 7f2b7ec93c347ef81cb6048c6895b967feaa2260 (patch) | |
tree | 65c1d6b1f96d33d226dc745645dea54d4ef7652f /sbin/fsck_msdosfs | |
parent | bcbc8d35eb309dbec93ba2a95c7ac9809fda1b38 (diff) | |
download | src-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.c | 4 |
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) { |