summaryrefslogtreecommitdiffstats
path: root/src/photorec.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-01-07 22:24:44 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2014-01-07 22:24:44 +0100
commitdb5f5e8713007aee561ba65cf9b8f13f4dec63d7 (patch)
tree4031a958fec546f1e4092985a07d053da73da508 /src/photorec.c
parent6c7f67e9abca52fc163a715c2b8902aeeed9317f (diff)
Fix bug in file_block_remove_from_sp() and file_block_truncate_zero()
Diffstat (limited to 'src/photorec.c')
-rw-r--r--src/photorec.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/photorec.c b/src/photorec.c
index 3a8f181..999073c 100644
--- a/src/photorec.c
+++ b/src/photorec.c
@@ -898,7 +898,7 @@ static int file_block_remove_from_sp(alloc_data_t *list_search_space, alloc_data
alloc_data_t *tmp;
tmp=td_list_entry(search_walker, alloc_data_t, list);
if(tmp->start <= *offset &&
- *offset + blocksize - 1 <= tmp->end)
+ *offset + blocksize <= tmp->end + 1)
{
if(tmp->start == *offset)
{
@@ -913,7 +913,7 @@ static int file_block_remove_from_sp(alloc_data_t *list_search_space, alloc_data
free(tmp);
return 0;
}
- if(*offset + blocksize == tmp->end)
+ if(*offset + blocksize == tmp->end + 1)
{
tmp->end-=blocksize;
*new_current_search_space=td_list_entry(tmp->list.next, alloc_data_t, list);
@@ -1065,7 +1065,7 @@ static void file_block_truncate_zero(const file_recovery_t *file_recovery, alloc
if(first)
{
file_block_truncate_zero_aux(element->start, element->end, list_search_space, file_recovery->file_stat);
- first=1;
+ first=0;
}
else
file_block_truncate_aux(element->start, element->end, list_search_space);