summaryrefslogtreecommitdiffstats
path: root/src/file_dad.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-08-09 09:41:50 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-08-09 09:41:50 +0200
commit32e432da4817399ea856ed769a208aca67c17d11 (patch)
treedbf8b4881955d1381a6b32f722496f440a56b3cf /src/file_dad.c
parent3bca46134672e719a274ef1f16e678388a51056f (diff)
PhotoRec: stricter check for .dad
Diffstat (limited to 'src/file_dad.c')
-rw-r--r--src/file_dad.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/file_dad.c b/src/file_dad.c
index 17712da..ba3f573 100644
--- a/src/file_dad.c
+++ b/src/file_dad.c
@@ -73,14 +73,18 @@ 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(file_recovery!=NULL &&
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))
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);
if(file_recovery_new->blocksize >= 16)
{
file_recovery_new->data_check=&data_check_dad;