summaryrefslogtreecommitdiffstats
path: root/src/file_fat.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-09-17 08:06:05 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-09-17 08:06:05 +0200
commit01cdfe1ca19f6f9193055ff67dc1db9a6d30a3b3 (patch)
treedd6df91460980285b23df16c8f8d408735765cfb /src/file_fat.c
parent1eab914e652098ac7904931f49176f7425d7257c (diff)
PhotoRec: stricter check for FAT image recovery
Diffstat (limited to 'src/file_fat.c')
-rw-r--r--src/file_fat.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/file_fat.c b/src/file_fat.c
index f940c3c..1f2926a 100644
--- a/src/file_fat.c
+++ b/src/file_fat.c
@@ -93,6 +93,8 @@ static int header_check_fat(const unsigned char *buffer, const unsigned int buff
part_size=(fat_sectors(fat_header)>0?fat_sectors(fat_header):le32(fat_header->total_sect));
start_fat1=le16(fat_header->reserved);
start_data=start_fat1+fat_header->fats*fat_length+(get_dir_entries(fat_header)*32+fat_sector_size(fat_header)-1)/fat_sector_size(fat_header);
+ if(part_size < start_data)
+ return 0;
no_of_cluster=(part_size-start_data)/fat_header->sectors_per_cluster;
if(no_of_cluster<4085)
{