mirror of
https://git.code.sf.net/p/ntfs-3g/ntfs-3g.git
synced 2024-11-23 18:14:24 +08:00
Improved the check for a valid $MFTMirr
The test for a valid $MFTMirr could segfault on a badly damaged partition. Add safety checks.
This commit is contained in:
parent
94f8d2128e
commit
9f22e17a16
@ -910,6 +910,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, ntfs_mount_flags flags)
|
||||
ATTR_RECORD *a;
|
||||
VOLUME_INFORMATION *vinf;
|
||||
ntfschar *vname;
|
||||
u32 record_size;
|
||||
int i, j, eo;
|
||||
unsigned int k;
|
||||
u32 u;
|
||||
@ -989,7 +990,10 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, ntfs_mount_flags flags)
|
||||
goto io_error_exit;
|
||||
}
|
||||
}
|
||||
if (memcmp(mrec, mrec2, ntfs_mft_record_get_data_size(mrec))) {
|
||||
record_size = ntfs_mft_record_get_data_size(mrec);
|
||||
if ((record_size <= sizeof(MFT_RECORD))
|
||||
|| (record_size > vol->mft_record_size)
|
||||
|| memcmp(mrec, mrec2, record_size)) {
|
||||
ntfs_log_error("$MFTMirr does not match $MFT (record "
|
||||
"%d).\n", i);
|
||||
goto io_error_exit;
|
||||
|
Loading…
Reference in New Issue
Block a user