PhotoRec: better file check for gif files

This commit is contained in:
Christophe Grenier 2014-03-29 11:24:44 +01:00
parent cd5f3bea4c
commit d02591d45c

View file

@ -83,7 +83,15 @@ static int header_check_gif(const unsigned char *buffer, const unsigned int buff
static void file_check_gif(file_recovery_t *file_recovery)
{
const unsigned char gif_footer[2]= {0x00, 0x3b};
file_search_footer(file_recovery, gif_footer, sizeof(gif_footer), 0);
unsigned char buffer[2];
if(fseek(file_recovery->handle, file_recovery->calculated_file_size-2, SEEK_SET)<0 ||
fread(buffer, 2, 1, file_recovery->handle)!=1 ||
memcmp(buffer, gif_footer, sizeof(gif_footer))!=0)
{
file_recovery->file_size=0;
return;
}
file_recovery->file_size=file_recovery->calculated_file_size;
}
static data_check_t data_check_gif(const unsigned char *buffer, const unsigned int buffer_size, file_recovery_t *file_recovery)