summaryrefslogtreecommitdiffstats
path: root/src/file_txt.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2015-12-03 13:33:34 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2015-12-03 13:33:34 +0100
commit4eb6d5ae37e873eb0a76a85e3e81c16feb9f2325 (patch)
tree478b7519b40bf580339538d51f97d02d5dcb4f27 /src/file_txt.c
parent6a008147ab65d5f3502b5c301ceca9dabb67c57f (diff)
PhotoRec; stricker check for .snz files
Diffstat (limited to 'src/file_txt.c')
-rw-r--r--src/file_txt.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/file_txt.c b/src/file_txt.c
index ff58a36..a8b799a 100644
--- a/src/file_txt.c
+++ b/src/file_txt.c
@@ -52,11 +52,21 @@ static inline int filtre(unsigned int car);
static void register_header_check_txt(file_stat_t *file_stat);
static int header_check_txt(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_fasttxt(file_stat_t *file_stat);
+static void register_header_check_snz(file_stat_t *file_stat);
static int header_check_fasttxt(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);
#ifdef UTF16
static int header_check_le16_txt(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);
#endif
+const file_hint_t file_hint_snz= {
+ .extension="snz",
+ .description="Olfaction SeeNez odorama",
+ .max_filesize=PHOTOREC_MAX_FILE_SIZE,
+ .recover=1,
+ .enable_by_default=1,
+ .register_header_check=&register_header_check_snz
+};
+
const file_hint_t file_hint_fasttxt= {
.extension="tx?",
.description="Text files with header: rtf,xml,xhtml,mbox/imm,pm,ram,reg,sh,slk,stp,jad,url",
@@ -162,9 +172,6 @@ static const txt_header_t fasttxt_headers[] = {
{ "#SeeNez ", 8, "SeeNezSST"},
/* Sylk, Multiplan Symbolic Link Interchange */
{ "ID;PSCALC3", 10, "slk"},
- /* Olfaction SeeNez odorama */
- { "DEFAULT\n", 8, "snz"},
- { "DEFAULT\r\n", 9, "snz"},
/* ISO 10303 is an ISO standard for the computer-interpretable
* representation and exchange of industrial product data.
* - Industrial automation systems and integration - Product data representation and exchange
@@ -1366,6 +1373,24 @@ static int header_check_stl(const unsigned char *buffer, const unsigned int buff
return 1;
}
+static int header_check_snz(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 unsigned int buffer_size_test=(buffer_size < 512? buffer_size : 512);
+ if(td_memmem(buffer, buffer_size_test, ".snz", 4)==NULL)
+ return 0;
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->data_check=&data_check_txt;
+ file_recovery_new->file_check=&file_check_size;
+ file_recovery_new->extension="snz";
+ return 1;
+}
+
+static void register_header_check_snz(file_stat_t *file_stat)
+{
+ register_header_check(0, "DEFAULT\n", 8, &header_check_snz, file_stat);
+ register_header_check(0, "DEFAULT\r\n", 9, &header_check_snz, file_stat);
+}
+
static void register_header_check_fasttxt(file_stat_t *file_stat)
{
static const unsigned char header_xml_utf8[17] = {0xef, 0xbb, 0xbf, '<', '?', 'x', 'm', 'l', ' ', 'v', 'e', 'r', 's', 'i', 'o', 'n', '='};