mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-23 08:11:04 +01:00
geom label msdosfs: sanity check BPB before using it for io request
It must be greater than zero, and be multiple of the device block size. In collaboration with: pho Reviewed by: markj, mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D33721
This commit is contained in:
parent
1849bc5f3f
commit
9f4073d446
@ -156,6 +156,12 @@ g_label_msdosfs_taste(struct g_consumer *cp, char *label, size_t size)
|
||||
G_LABEL_DEBUG(2,
|
||||
"MSDOSFS: FAT_FirstDataSector=0x%x, FAT_BytesPerSector=%d",
|
||||
fat_FirstDataSector, fat_BytesPerSector);
|
||||
if (fat_BytesPerSector == 0 ||
|
||||
fat_BytesPerSector % pp->sectorsize != 0) {
|
||||
G_LABEL_DEBUG(1, "MSDOSFS: %s: corrupted BPB",
|
||||
pp->name);
|
||||
goto error;
|
||||
}
|
||||
|
||||
for (offset = fat_BytesPerSector * fat_FirstDataSector;;
|
||||
offset += fat_BytesPerSector) {
|
||||
|
Loading…
Reference in New Issue
Block a user