Hardened the check of locations of MFT and MFTMirr

The MFT and MFTMirr may not be negative or overlap the boot sector.
edge.strict_endians^2
Jean-Pierre André 2021-07-12 08:31:18 +02:00
parent 7f45544ed7
commit af1bc0f5ec
1 changed files with 3 additions and 1 deletions

View File

@ -155,7 +155,9 @@ BOOL ntfs_boot_sector_is_ntfs(NTFS_BOOT_SECTOR *b)
}
/* MFT and MFTMirr may not overlap the boot sector or be the same */
if (!b->mft_lcn || !b->mftmirr_lcn || (b->mft_lcn == b->mftmirr_lcn)) {
if (((s64)sle64_to_cpu(b->mft_lcn) <= 0)
|| ((s64)sle64_to_cpu(b->mftmirr_lcn) <= 0)
|| (b->mft_lcn == b->mftmirr_lcn)) {
ntfs_log_error("Invalid location of MFT or MFTMirr.\n");
goto not_ntfs;
}