summaryrefslogtreecommitdiffstats
path: root/src/file_bmp.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-09-17 08:05:38 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-09-17 08:05:38 +0200
commit1eab914e652098ac7904931f49176f7425d7257c (patch)
treeb2d70fe87d7737ae59b2a2fcbb08433c4088a4d8 /src/file_bmp.c
parentf631f0278b1b1cc3f1d3e7523d727a39be2351e3 (diff)
PhotoRec: stricter check for .bmp
Diffstat (limited to 'src/file_bmp.c')
-rw-r--r--src/file_bmp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/file_bmp.c b/src/file_bmp.c
index 5ec2cd7..9a3ef21 100644
--- a/src/file_bmp.c
+++ b/src/file_bmp.c
@@ -66,7 +66,8 @@ static int header_check_bmp(const unsigned char *buffer, const unsigned int buff
(buffer[14]==12 || buffer[14]==64 || buffer[14]==40 || buffer[14]==52 ||
buffer[14]==56 || buffer[14]==108 || buffer[14]==124) &&
buffer[15]==0 && buffer[16]==0 && buffer[17]==0 &&
- le32(bm->offset) < le32(bm->size))
+ le32(bm->offset) < le32(bm->size) &&
+ le32(bm->size) >= 65)
{
/* See http://en.wikipedia.org/wiki/BMP_file_format */
reset_file_recovery(file_recovery_new);