summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2020-09-13 18:55:22 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2020-09-13 18:55:22 +0200
commit8972b0caae779ac91fbc6f1633e265124fd1a3b4 (patch)
treea562d947db35d360b2bd11b0ac68d3e8d57c22c6
parent1e240053d7f59f9faa26f34d083bfd4b0ec1bc6c (diff)
PhotoRec: src/file_gi.c - Ignore header when recorded filesize is too large for a real file
-rw-r--r--src/file_gi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/file_gi.c b/src/file_gi.c
index 0fc12f8..9784612 100644
--- a/src/file_gi.c
+++ b/src/file_gi.c
@@ -52,6 +52,8 @@ struct header_gi
static int header_check_gi(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 struct header_gi *hdr=(const struct header_gi *)buffer;
+ if(le64(hdr->size) > PHOTOREC_MAX_FILE_SIZE)
+ return 0;
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_gi.extension;
file_recovery_new->calculated_file_size=le64(hdr->size)+20;