summaryrefslogtreecommitdiffstats
path: root/src/file_one.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-07-26 19:14:45 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-07-26 19:14:45 +0200
commitb7e5378f395a3b9e57b064d083f79e225a94ef4f (patch)
treef7bd065e9a7ceeb66b5fa4a87febd7be32757448 /src/file_one.c
parent8cc56c25a09fc0d3806c0f6ced97b2129b2e9594 (diff)
PhotoRec: stricter check for .one
Diffstat (limited to 'src/file_one.c')
-rw-r--r--src/file_one.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/file_one.c b/src/file_one.c
index 5a99eff..7f4b93c 100644
--- a/src/file_one.c
+++ b/src/file_one.c
@@ -44,10 +44,13 @@ const file_hint_t file_hint_one= {
static int header_check_one(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 uint64_t size=(buffer[196]<<0)+(buffer[197]<<8)+(buffer[198]<<16)+((uint64_t)buffer[199]<<24);
+ if(size < 200)
+ return 0;
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_one.extension;
file_recovery_new->min_filesize=200;
- file_recovery_new->calculated_file_size=(buffer[196]<<0)+(buffer[197]<<8)+(buffer[198]<<16)+((uint64_t)buffer[199]<<24);
+ file_recovery_new->calculated_file_size=size;
file_recovery_new->data_check=&data_check_size;
file_recovery_new->file_check=&file_check_size;
return 1;