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 6c29bbe8d5%5E%21/
MFC after:	2 weeks
This commit is contained in:
Xin LI 2018-07-13 02:02:16 +00:00
parent bcbc8d35eb
commit 7f2b7ec93c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336236

View File

@ -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) {