summaryrefslogtreecommitdiffstats
path: root/src/godmode.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2008-11-18 20:14:49 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2008-11-18 20:14:49 +0100
commit66d4eff0c35d101e390fda3705b70d0d4de12e6d (patch)
tree2f72397c9117ad28354dbd6f002518a3ecd487b1 /src/godmode.c
parent225976168a2f59bc1d0dfa58bf4f3e23ef253d55 (diff)
When searching for a partition, TestDisk can read up to one cylinder after
the supposed end of disk.
Diffstat (limited to 'src/godmode.c')
-rw-r--r--src/godmode.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/godmode.c b/src/godmode.c
index a475f3e..a3dbc98 100644
--- a/src/godmode.c
+++ b/src/godmode.c
@@ -393,8 +393,9 @@ static list_part_t *search_part(disk_t *disk_car, const list_part_t *list_part_o
list_part_t *list_part_bad=NULL;
partition_t *partition;
/* It's not a problem to read a little bit more than necessary */
- const uint64_t search_location_max=td_max(disk_car->disk_size +
- disk_car->geom.heads_per_cylinder * disk_car->geom.sectors_per_head * disk_car->sector_size,
+ const uint64_t search_location_max=td_max((disk_car->disk_size /
+ ((uint64_t) disk_car->geom.heads_per_cylinder * disk_car->geom.sectors_per_head * disk_car->sector_size) + 1 ) *
+ ((uint64_t) disk_car->geom.heads_per_cylinder * disk_car->geom.sectors_per_head * disk_car->sector_size),
disk_car->disk_real_size);
const uint64_t max_disk_size_for_partition=td_max(disk_car->disk_size,
(uint64_t)disk_car->geom.cylinders*disk_car->geom.heads_per_cylinder * disk_car->geom.sectors_per_head * disk_car->sector_size);