summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2017-06-18 12:16:08 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2017-06-18 12:16:08 +0200
commit607c909d79e4bc317668c0244cc7c63136b0cebb (patch)
tree39cba0e9f9f1982b7650fdea34eea05f91cd3203 /src
parentc16a893f92fb807ac8cb9c76e065c0dfbf45cc2d (diff)
PhotoRec: another fix for Windows 9 x.reg bound checking
Thanks to Adel KHALDI from Blue Frost Security GmbH for reporting the problem.
Diffstat (limited to 'src')
-rw-r--r--src/file_reg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/file_reg.c b/src/file_reg.c
index 4540d82..73bf7b4 100644
--- a/src/file_reg.c
+++ b/src/file_reg.c
@@ -72,7 +72,7 @@ struct rgdb_block
static int header_check_reg_9x(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 creg_file_header*header=(const struct creg_file_header*)buffer;
- if(le32(header->rgdb_offset)+4 > buffer_size)
+ if(le32(header->rgdb_offset) > buffer_size - 4)
return 0;
{
const struct rgdb_block*block=(const struct rgdb_block*)(buffer+le32(header->rgdb_offset));