From 97ad47575021abe3053e9871e34549bc954f31d6 Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Fri, 21 May 2010 09:08:30 +0200 Subject: [PATCH] PhotoRec: stricter check for .swf/.swc --- src/file_swf.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/file_swf.c b/src/file_swf.c index 22c85d8e..fb1bbb2a 100644 --- a/src/file_swf.c +++ b/src/file_swf.c @@ -55,13 +55,15 @@ 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) + if(memcmp(buffer, swf_header_compressed, sizeof(swf_header_compressed))==0 && + buffer[3]>0 && buffer[3]<=20) { /* Compressed flash */ reset_file_recovery(file_recovery_new); file_recovery_new->extension="swc"; return 1; } - if(memcmp(buffer, swf_header, sizeof(swf_header))==0) + if(memcmp(buffer, swf_header, sizeof(swf_header))==0 && + buffer[3]>0 && buffer[3]<=20) { reset_file_recovery(file_recovery_new); file_recovery_new->extension=file_hint_swf.extension;