summaryrefslogtreecommitdiffstats
path: root/src/file_dad.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2015-09-03 08:04:04 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2015-09-03 08:04:04 +0200
commit00557961744f0a88000678db179a84a4a0e4fdfd (patch)
treedb0bae677a788104fa71edaebcbfa30402833179 /src/file_dad.c
parentac980c4a61e0158ce5ceec8555a89b38eac5066c (diff)
PhotoRec: reduce the number of backward search
Diffstat (limited to 'src/file_dad.c')
-rw-r--r--src/file_dad.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/file_dad.c b/src/file_dad.c
index 863b023..5ce0db1 100644
--- a/src/file_dad.c
+++ b/src/file_dad.c
@@ -73,13 +73,16 @@ static data_check_t data_check_dad(const unsigned char *buffer, const unsigned i
static int header_check_dad(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new)
{
const struct dad_header *dad=(const struct dad_header *)buffer;
+ if(le32(dad->size)<16)
+ return 0;
if(file_recovery->file_stat!=NULL &&
file_recovery->file_stat->file_hint==&file_hint_dad &&
(file_recovery->calculated_file_size==file_recovery->file_size ||
file_recovery->blocksize < 16))
+ {
+ header_ignored(file_recovery_new);
return 0;
- if(le32(dad->size)<16)
- return 0;
+ }
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_dad.extension;
file_recovery_new->min_filesize=le32(dad->size);