summaryrefslogtreecommitdiffstats
path: root/src/file_flac.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2013-03-10 16:00:58 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2013-03-10 16:00:58 +0100
commit5f635200cf8795e91b8baebdadf5fe094e6ecfbd (patch)
tree4df2fe48bc8709fb49ac36034adbaa2506c529f9 /src/file_flac.c
parent5c1125c20b7ad39e5dc4f7660210e28ef2f929d6 (diff)
PhotoRec: better signature for .flac
Diffstat (limited to 'src/file_flac.c')
-rw-r--r--src/file_flac.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/src/file_flac.c b/src/file_flac.c
index 5ae428f..33d14a3 100644
--- a/src/file_flac.c
+++ b/src/file_flac.c
@@ -32,7 +32,6 @@
#include "common.h"
static void register_header_check_flac(file_stat_t *file_stat);
-static int header_check_flac(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_flac= {
.extension="flac",
@@ -44,25 +43,21 @@ const file_hint_t file_hint_flac= {
.register_header_check=&register_header_check_flac
};
-static const unsigned char flac_header[4]= {'f', 'L', 'a', 'C'};
-
-static void register_header_check_flac(file_stat_t *file_stat)
-{
- register_header_check(0, flac_header,sizeof(flac_header), &header_check_flac, file_stat);
-}
-
static int header_check_flac(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, flac_header, sizeof(flac_header))==0)
- {
- reset_file_recovery(file_recovery_new);
+ reset_file_recovery(file_recovery_new);
#ifdef DJGPP
- file_recovery_new->extension="flc";
+ file_recovery_new->extension="flc";
#else
- file_recovery_new->extension=file_hint_flac.extension;
+ file_recovery_new->extension=file_hint_flac.extension;
#endif
- return 1;
- }
- return 0;
}
+static void register_header_check_flac(file_stat_t *file_stat)
+{
+ /* Stream marker followed by STREAMINFO Metadata block */
+ static const unsigned char flac_header[4]= {'f', 'L', 'a', 'C', 0x00};
+ static const unsigned char flac_header2[4]= {'f', 'L', 'a', 'C', 0x80};
+ register_header_check(0, flac_header,sizeof(flac_header), &header_check_flac, file_stat);
+ register_header_check(0, flac_header2,sizeof(flac_header2), &header_check_flac, file_stat);
+}