summaryrefslogtreecommitdiffstats
path: root/src/file_bld.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-07-26 15:48:33 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-07-26 15:48:33 +0200
commita615ff69bb80aa342eadfc236976ec7bd3b4263b (patch)
treeb607c8dd8e92e87af45b1602f12fea38a96f5d4a /src/file_bld.c
parent95c0ae6a66ab4c27ed652a8f26c366fd4c71157c (diff)
PhotoRec: disable data check of .blender files for small blocksize
Diffstat (limited to 'src/file_bld.c')
-rw-r--r--src/file_bld.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/file_bld.c b/src/file_bld.c
index ad8777b..34015a2 100644
--- a/src/file_bld.c
+++ b/src/file_bld.c
@@ -58,29 +58,29 @@ static void register_header_check_blend(file_stat_t *file_stat)
static int header_check_blend(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)
{
- if(memcmp(buffer,blend_header,sizeof(blend_header))==0 && (buffer[7]=='_' || buffer[7]=='-'))
- {
- reset_file_recovery(file_recovery_new);
- file_recovery_new->calculated_file_size=12;
- if(buffer[8]=='v')
- { /* Little endian */
- if(buffer[7]=='_')
- file_recovery_new->data_check=&data_check_blend4le;
- else
- file_recovery_new->data_check=&data_check_blend8le;
- }
- else
- { /* Big endian */
- if(buffer[7]=='_')
- file_recovery_new->data_check=&data_check_blend4be;
- else
- file_recovery_new->data_check=&data_check_blend8be;
- }
- file_recovery_new->extension=file_hint_blend.extension;
- file_recovery_new->file_check=&file_check_size;
+ if(buffer[7]!='_' && buffer[7]!='-')
+ return 0;
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_blend.extension;
+ if(file_recovery_new->blocksize < 0x14)
return 1;
+ file_recovery_new->calculated_file_size=12;
+ if(buffer[8]=='v')
+ { /* Little endian */
+ if(buffer[7]=='_')
+ file_recovery_new->data_check=&data_check_blend4le;
+ else
+ file_recovery_new->data_check=&data_check_blend8le;
+ }
+ else
+ { /* Big endian */
+ if(buffer[7]=='_')
+ file_recovery_new->data_check=&data_check_blend4be;
+ else
+ file_recovery_new->data_check=&data_check_blend8be;
}
- return 0;
+ file_recovery_new->file_check=&file_check_size;
+ return 1;
}
static data_check_t data_check_blend4le(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)