summaryrefslogtreecommitdiffstats
path: root/src/file_veg.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-07-26 22:43:46 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-07-26 22:43:46 +0200
commit132fba09962b72a9a86739b968faaa53f140150d (patch)
tree4837b619849ffd8442176de2b14eaa2b57d0a678 /src/file_veg.c
parentc7aae7f0b379d85b554bb5e61f97070bf9259182 (diff)
PhotoRec: stricter check for .veg
Diffstat (limited to 'src/file_veg.c')
-rw-r--r--src/file_veg.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/file_veg.c b/src/file_veg.c
index 0863984..6e09a41 100644
--- a/src/file_veg.c
+++ b/src/file_veg.c
@@ -44,9 +44,12 @@ const file_hint_t file_hint_veg= {
static int header_check_veg(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->calculated_file_size=(uint64_t)buffer[0x10] + (((uint64_t)buffer[0x11])<<8) +
+ const uint64_t size= (uint64_t)buffer[0x10] + (((uint64_t)buffer[0x11])<<8) +
(((uint64_t)buffer[0x12])<<16) + (((uint64_t)buffer[0x13])<<24);
+ if(size < 0x14)
+ return 0;
+ reset_file_recovery(file_recovery_new);
+ file_recovery_new->calculated_file_size=size;
file_recovery_new->data_check=&data_check_size;
file_recovery_new->file_check=&file_check_size;
file_recovery_new->extension=file_hint_veg.extension;