summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-03-10 16:05:41 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2013-03-10 16:05:41 +0100
commit0620a4a4664117844d54c2bd0b0fcef609c338e2 (patch)
tree5aa5af7d2214104c8612c2f8768cf51e50a4c960
parent622e8c7f19ff7dc9287fb5a43452d876c4d979a8 (diff)
PhotoRec: more robust signature for .spss
-rw-r--r--src/file_spss.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/src/file_spss.c b/src/file_spss.c
index 4fa39d8..9199135 100644
--- a/src/file_spss.c
+++ b/src/file_spss.c
@@ -31,7 +31,6 @@
#include "filegen.h"
static void register_header_check_spss(file_stat_t *file_stat);
-static int header_check_spss(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_spss= {
.extension="sav",
@@ -43,20 +42,15 @@ const file_hint_t file_hint_spss= {
.register_header_check=&register_header_check_spss
};
-static const unsigned char spss_header[4]= {'$', 'F', 'L', '2'};
-
-static void register_header_check_spss(file_stat_t *file_stat)
+static int header_check_spss(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)
{
- register_header_check(0, spss_header,sizeof(spss_header), &header_check_spss, file_stat);
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_spss.extension;
+ return 1;
}
-static int header_check_spss(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 void register_header_check_spss(file_stat_t *file_stat)
{
- if(memcmp(buffer,spss_header,sizeof(spss_header))==0)
- {
- reset_file_recovery(file_recovery_new);
- file_recovery_new->extension=file_hint_spss.extension;
- return 1;
- }
- return 0;
+ /* Check record type + beginning of product name*/
+ register_header_check(0, "$FL2@(#) SPSS DATA FILE", 23, &header_check_spss, file_stat);
}