PhotoRec: stricter check for .par2
This commit is contained in:
parent
736adffc50
commit
69e5dde9c0
1 changed files with 3 additions and 0 deletions
|
@ -108,10 +108,13 @@ static void file_rename_par2(const char *old_filename)
|
||||||
|
|
||||||
static int header_check_par2(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)
|
static int header_check_par2(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)
|
||||||
{
|
{
|
||||||
|
const uint64_t length=le64((*(const uint64_t *)(&buffer[8])));
|
||||||
if(file_recovery!=NULL &&
|
if(file_recovery!=NULL &&
|
||||||
file_recovery->file_stat!=NULL &&
|
file_recovery->file_stat!=NULL &&
|
||||||
file_recovery->file_stat->file_hint==&file_hint_par2)
|
file_recovery->file_stat->file_hint==&file_hint_par2)
|
||||||
return 0;
|
return 0;
|
||||||
|
if(length % 4 !=0 || length < 16)
|
||||||
|
return 0;
|
||||||
reset_file_recovery(file_recovery_new);
|
reset_file_recovery(file_recovery_new);
|
||||||
file_recovery_new->extension=file_hint_par2.extension;
|
file_recovery_new->extension=file_hint_par2.extension;
|
||||||
file_recovery_new->file_rename=&file_rename_par2;
|
file_recovery_new->file_rename=&file_rename_par2;
|
||||||
|
|
Loading…
Reference in a new issue