summaryrefslogtreecommitdiffstats
path: root/src/file_ecryptfs.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-07-26 15:35:13 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-07-26 15:35:13 +0200
commit02c923b69c85f4a6459719678b0e30aa1fe26ace (patch)
tree230f32a42cc9431dd342b55713d50ae0edad68cb /src/file_ecryptfs.c
parent4d22466587757e601dbaf03a0acf0e34af565d6e (diff)
PhotoRec: stricter check .eCryptfs files
Diffstat (limited to 'src/file_ecryptfs.c')
-rw-r--r--src/file_ecryptfs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/file_ecryptfs.c b/src/file_ecryptfs.c
index 9f18b14..8e19f18 100644
--- a/src/file_ecryptfs.c
+++ b/src/file_ecryptfs.c
@@ -74,6 +74,8 @@ static int header_check_ecryptfs(const unsigned char *buffer, const unsigned int
const struct ecrypfs_header *e=(const struct ecrypfs_header *)buffer;
if((be32(e->marker1) ^ be32(e->marker2)) != 0x3c81b7f5)
return 0;
+ if(be64(e->unencrypted_file_size) < sizeof(struct ecrypfs_header))
+ return 0;
reset_file_recovery(file_recovery_new);
#ifdef DJGPP
file_recovery_new->extension="ecr";