PhotoRec: stricter check for .dmp
This commit is contained in:
parent
a322b3f823
commit
3e3745fb7f
1 changed files with 12 additions and 15 deletions
|
@ -31,7 +31,6 @@
|
|||
#include "filegen.h"
|
||||
|
||||
static void register_header_check_dmp(file_stat_t *file_stat);
|
||||
static int header_check_dmp(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 file_hint_t file_hint_dmp= {
|
||||
.extension="dmp",
|
||||
|
@ -43,23 +42,21 @@ const file_hint_t file_hint_dmp= {
|
|||
.register_header_check=®ister_header_check_dmp
|
||||
};
|
||||
|
||||
static const unsigned char dmp_header[11]= {
|
||||
0x03, 0x00, 0x01, 'E', 'X', 'P', 'O', 'R',
|
||||
'T', ':', 'V'
|
||||
};
|
||||
|
||||
static void register_header_check_dmp(file_stat_t *file_stat)
|
||||
{
|
||||
register_header_check(0, dmp_header, sizeof(dmp_header), &header_check_dmp, file_stat);
|
||||
}
|
||||
|
||||
static int header_check_dmp(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[0], dmp_header, sizeof(dmp_header))==0)
|
||||
{
|
||||
if(buffer[11] < '0' || buffer[11] > '9')
|
||||
return 0;
|
||||
reset_file_recovery(file_recovery_new);
|
||||
file_recovery_new->extension=file_hint_dmp.extension;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void register_header_check_dmp(file_stat_t *file_stat)
|
||||
{
|
||||
static const unsigned char dmp_header[11]= {
|
||||
0x03, 0x00, 0x01, 'E', 'X', 'P', 'O', 'R',
|
||||
'T', ':', 'V'
|
||||
};
|
||||
register_header_check(0, dmp_header, sizeof(dmp_header), &header_check_dmp, file_stat);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue