summaryrefslogtreecommitdiffstats
path: root/src/fatp.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2011-12-03 10:05:43 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2011-12-03 10:05:43 +0100
commit5a8a0f5eb583f596adc8651cb0ff1aef3f5388ca (patch)
tree5ee5bebfac9da88e273b88a6aa4e61c3ab85e7bd /src/fatp.c
parentebc6574a5f248c44c445ae25d9f9185f354d9a7b (diff)
Before removing allocated from PhotoRec search space, check the sector size stored in FAT boot sector
Diffstat (limited to 'src/fatp.c')
-rw-r--r--src/fatp.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/fatp.c b/src/fatp.c
index 7ba843c..2a9342f 100644
--- a/src/fatp.c
+++ b/src/fatp.c
@@ -196,6 +196,11 @@ unsigned int fat_remove_used_space(disk_t *disk_car, const partition_t *partitio
return 0;
}
sector_size=fat_sector_size(fat_header);
+ if(sector_size==0)
+ {
+ free(buffer);
+ return 0;
+ }
fat_length=le16(fat_header->fat_length)>0?le16(fat_header->fat_length):le32(fat_header->fat32_length);
part_size=(sectors(fat_header)>0?sectors(fat_header):le32(fat_header->total_sect));
start_fat1=le16(fat_header->reserved);