PhotoRec: stricter check for .dat

This commit is contained in:
Christophe Grenier 2014-07-24 23:41:45 +02:00
parent 301a06ab6f
commit e911b57a11

View file

@ -51,10 +51,13 @@ static int header_check_dat(const unsigned char *buffer, const unsigned int buff
static int header_check_datIE(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 size=(uint64_t)buffer[0x1C]+(((uint64_t)buffer[0x1D])<<8)+(((uint64_t)buffer[0x1E])<<16)+(((uint64_t)buffer[0x1F])<<24);
if(size < 0x20)
return 0;
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_dat.extension;
file_recovery_new->min_filesize=0x20;
file_recovery_new->calculated_file_size=(uint64_t)buffer[0x1C]+(((uint64_t)buffer[0x1D])<<8)+(((uint64_t)buffer[0x1E])<<16)+(((uint64_t)buffer[0x1F])<<24);
file_recovery_new->calculated_file_size=size;
file_recovery_new->data_check=&data_check_size;
file_recovery_new->file_check=&file_check_size;
return 1;