PhotoRec: stricter check for .swf/.swc

This commit is contained in:
Christophe Grenier 2010-05-21 09:08:30 +02:00
parent 8a541396e3
commit 97ad475750

View file

@ -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;