summaryrefslogtreecommitdiffstats
path: root/src/file_exs.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-03-10 16:00:02 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2013-03-10 16:00:02 +0100
commit5c1125c20b7ad39e5dc4f7660210e28ef2f929d6 (patch)
tree2bca8257f31863c106ce452621ef0930a7b046ca /src/file_exs.c
parent9dc38460561fa9710d629912c50e44a70ab94ba9 (diff)
PhotoRec: stricter checks for .exs
Diffstat (limited to 'src/file_exs.c')
-rw-r--r--src/file_exs.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/file_exs.c b/src/file_exs.c
index db62090..370f292 100644
--- a/src/file_exs.c
+++ b/src/file_exs.c
@@ -54,24 +54,21 @@ static void file_rename_exs(const char *old_filename)
file_rename(old_filename, buffer, buffer_size, 0x14, "exs", 0);
}
-static const unsigned char exs_header[8]= {
- 0x01, 0x01, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00
-};
-
static int header_check_exs(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], exs_header, sizeof(exs_header))==0)
- {
- reset_file_recovery(file_recovery_new);
- file_recovery_new->extension=file_hint_exs.extension;
- file_recovery_new->file_rename=file_rename_exs;
- return 1;
- }
- return 0;
+ if(memcmp(&buffer[0x10], "TBOS", 4)!=0)
+ return 0;
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_exs.extension;
+ file_recovery_new->file_rename=file_rename_exs;
+ return 1;
}
static void register_header_check_exs(file_stat_t *file_stat)
{
+ static const unsigned char exs_header[8]= {
+ 0x01, 0x01, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00
+ };
register_header_check(0, exs_header, sizeof(exs_header), &header_check_exs, file_stat);
}