summaryrefslogtreecommitdiffstats
path: root/src/file_swf.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2011-10-30 12:17:11 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2011-10-30 12:17:11 +0100
commiteacb786b64669ebc7d9c2581abcdad591c99d2f5 (patch)
tree6b8c84b7c92d6270b3aaa9816b5d712a5471e5ee /src/file_swf.c
parent622c4c001b076896ee959efdace4c8f81eb8937b (diff)
PhotoRec: stricter check for compressed flash .swc
Diffstat (limited to 'src/file_swf.c')
-rw-r--r--src/file_swf.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/file_swf.c b/src/file_swf.c
index fb1bbb2..fc33dd6 100644
--- a/src/file_swf.c
+++ b/src/file_swf.c
@@ -56,10 +56,13 @@ static void register_header_check_swf(file_stat_t *file_stat)
static int header_check_swf(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, swf_header_compressed, sizeof(swf_header_compressed))==0 &&
- buffer[3]>0 && buffer[3]<=20)
- { /* Compressed flash */
+ buffer[3]>=6 && buffer[3]<=20 && (buffer[8]&0x0f)==8)
+ { /* Compressed flash with Z_DEFLATED */
reset_file_recovery(file_recovery_new);
file_recovery_new->extension="swc";
+ file_recovery_new->calculated_file_size=(uint64_t)buffer[4]+(((uint64_t)buffer[5])<<8)+(((uint64_t)buffer[6])<<16)+(((uint64_t)buffer[7])<<24);
+ file_recovery_new->data_check=&data_check_size;
+ file_recovery_new->file_check=&file_check_size;
return 1;
}
if(memcmp(buffer, swf_header, sizeof(swf_header))==0 &&