summaryrefslogtreecommitdiffstats
path: root/src/file_nds.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-08-13 08:32:48 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-08-13 08:32:48 +0200
commit736adffc5038db051d291650abc6e0782bb960bd (patch)
tree60f8157c9b9c125095b245593152cbc2547a5ad3 /src/file_nds.c
parentcbb6a3005df37b3b41f8c99158c1dc3c2b5af32c (diff)
PhotoRec: define a minimal filesize for .nds
Diffstat (limited to 'src/file_nds.c')
-rw-r--r--src/file_nds.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/file_nds.c b/src/file_nds.c
index bd05f9b..1d1978e 100644
--- a/src/file_nds.c
+++ b/src/file_nds.c
@@ -31,7 +31,6 @@
#include "filegen.h"
static void register_header_check_nds(file_stat_t *file_stat);
-static int header_check_nds(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_nds= {
.extension="nds",
@@ -43,22 +42,19 @@ const file_hint_t file_hint_nds= {
.register_header_check=&register_header_check_nds
};
-static const unsigned char nds_header[6]= {
- 0x24, 0xff, 0xae, 0x51, 0x69, 0x9a
-};
+static int header_check_nds(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)
+{
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->extension=file_hint_nds.extension;
+ file_recovery_new->min_filesize=0xc6;
+ return 1;
+}
static void register_header_check_nds(file_stat_t *file_stat)
{
+ static const unsigned char nds_header[6]= {
+ 0x24, 0xff, 0xae, 0x51, 0x69, 0x9a
+ };
register_header_check(0xc0, nds_header, sizeof(nds_header), &header_check_nds, file_stat);
}
-static int header_check_nds(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[0xc0], nds_header, sizeof(nds_header))==0)
- {
- reset_file_recovery(file_recovery_new);
- file_recovery_new->extension=file_hint_nds.extension;
- return 1;
- }
- return 0;
-}