summaryrefslogtreecommitdiffstats
path: root/src/ntfs.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2017-07-05 13:27:24 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2017-07-05 13:27:24 +0200
commit0f97d72be8db4447e4c99e851cce491d9cfa1227 (patch)
tree93d225b5dadeb703d550483f28c7dc88d4099343 /src/ntfs.c
parent622d1eb668fd3aa7e63271b90001959c599b4756 (diff)
TestDisk: stricter check on NTFS MFT record size to avoid out of bound read
Thanks to Adel KHALDI from Blue Frost Security GmbH for reporting the problem.
Diffstat (limited to 'src/ntfs.c')
-rw-r--r--src/ntfs.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ntfs.c b/src/ntfs.c
index c624ee2..ee47e0a 100644
--- a/src/ntfs.c
+++ b/src/ntfs.c
@@ -311,12 +311,12 @@ static void ntfs_get_volume_name(disk_t *disk_car, partition_t *partition, const
/* Record 3 = $Volume */
mft_pos+=3*mft_record_size;
#ifdef NTFS_DEBUG
- log_debug("NTFS MFT cluster = %lu\n",le64(ntfs_header->mft_lcn));
- log_debug("NTFS cluster size = %5u sectors\n",ntfs_header->sectors_per_cluster);
- log_debug("NTFS MFT_record_size = %5u bytes\n",mft_record_size);
- log_debug("NTFS sector size = %5u bytes\n", ntfs_sector_size(ntfs_header));
+ log_info("NTFS MFT cluster = %lu\n",le64(ntfs_header->mft_lcn));
+ log_info("NTFS cluster size = %5u sectors\n",ntfs_header->sectors_per_cluster);
+ log_info("NTFS MFT_record_size = %5u bytes\n",mft_record_size);
+ log_info("NTFS sector size = %5u bytes\n", ntfs_sector_size(ntfs_header));
#endif
- if(mft_record_size==0)
+ if(mft_record_size < 42)
{
log_error("Invalid MFT record size or NTFS sector size\n");
return;