summaryrefslogtreecommitdiffstats
path: root/src/file_swf.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2010-05-21 09:08:30 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2010-05-21 09:08:30 +0200
commit97ad47575021abe3053e9871e34549bc954f31d6 (patch)
tree34f1e2a19eeaac5bf04358e0aa7bb2ffe610d58b /src/file_swf.c
parent8a541396e3f718adba4a8f8ccfbfa2778458211f (diff)
PhotoRec: stricter check for .swf/.swc
Diffstat (limited to 'src/file_swf.c')
-rw-r--r--src/file_swf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/file_swf.c b/src/file_swf.c
index 22c85d8..fb1bbb2 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;