summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2020-01-26 16:48:24 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2020-01-26 16:48:24 +0100
commit1c553c113750843863e52db8d77a8dc3ad297bbf (patch)
treebf13505f4621eb1c7d8e6ba6a708ecba82aed2c0
parente2fb8dbf4bd02f5a664af2668c6691a48a5a178f (diff)
PhotoRec: fix get_prev_location_smart(), avoid a potential enless loop
in PhotoRec itself.
-rw-r--r--src/filegen.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/filegen.c b/src/filegen.c
index 26ef872..e76010c 100644
--- a/src/filegen.c
+++ b/src/filegen.c
@@ -835,12 +835,13 @@ void get_prev_location_smart(alloc_data_t *list_search_space, alloc_data_t **cur
return;
}
*current_search_space=file_space;
- if(file_space->start < prev_location || file_space->start < offset_skipped_header)
+ if(file_space->start < offset_skipped_header)
{
#ifdef DEBUG_PREV_LOCATION
- log_info("get_prev_location_smart: file_space->start < prev_location=%llu (in 512-bytes sectors), offset=%llu\n",
+ log_info("get_prev_location_smart: file_space->start < offset_skipped_header, prev_location=%llu (in 512-bytes sectors), offset=%llu => %llu\n",
(long long unsigned)(prev_location/512),
- (long long unsigned)(*offset/512));
+ (long long unsigned)(*offset/512),
+ (long long unsigned)(offset_skipped_header/512));
#endif
*offset=offset_skipped_header;
offset_skipped_header=0;