summaryrefslogtreecommitdiffstats
path: root/src/file_ico.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2014-09-17 08:06:29 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2014-09-17 08:06:29 +0200
commit3c2a72d503acb5f385090395042fec3488ede548 (patch)
treebed5dfaef68cc8b499d0a79739f12fa435ed3bb1 /src/file_ico.c
parent01cdfe1ca19f6f9193055ff67dc1db9a6d30a3b3 (diff)
PhotoRec: stricter check for .ico
Diffstat (limited to 'src/file_ico.c')
-rw-r--r--src/file_ico.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/file_ico.c b/src/file_ico.c
index bf06af2..645b48a 100644
--- a/src/file_ico.c
+++ b/src/file_ico.c
@@ -89,7 +89,8 @@ static int header_check_ico(const unsigned char *buffer, const unsigned int buff
le16(ico_dir->bits_per_pixel)==8 ||
le16(ico_dir->bits_per_pixel)==16 ||
le16(ico_dir->bits_per_pixel)==32) &&
- le32(ico_dir->bitmap_offset) >= sizeof(struct ico_header)+le16(ico->count)*sizeof(struct ico_directory))
+ le32(ico_dir->bitmap_offset) >= sizeof(struct ico_header)+le16(ico->count)*sizeof(struct ico_directory) &&
+ le32(ico_dir->bitmap_size) > 0)
{
reset_file_recovery(file_recovery_new);
file_recovery_new->extension=file_hint_ico.extension;