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:
parent
bcbc8d35eb
commit
7f2b7ec93c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336236
@ -87,6 +87,10 @@ readboot(int dosfs, struct bootblock *boot)
|
|||||||
pfatal("Invalid sector size: %u", boot->bpbBytesPerSec);
|
pfatal("Invalid sector size: %u", boot->bpbBytesPerSec);
|
||||||
return FSFATAL;
|
return FSFATAL;
|
||||||
}
|
}
|
||||||
|
if (boot->bpbFATs == 0) {
|
||||||
|
pfatal("Invalid number of FATs: %u", boot->bpbFATs);
|
||||||
|
return FSFATAL;
|
||||||
|
}
|
||||||
if (!boot->bpbRootDirEnts)
|
if (!boot->bpbRootDirEnts)
|
||||||
boot->flags |= FAT32;
|
boot->flags |= FAT32;
|
||||||
if (boot->flags & FAT32) {
|
if (boot->flags & FAT32) {
|
||||||
|
Loading…
Reference in New Issue
Block a user