Skip to content
Permalink
Browse files Browse the repository at this point in the history
handle: Check that pages do not extend beyond the end of the file.
Thanks: Mahmoud Al-Qudsi
  • Loading branch information
rwmjones committed Oct 30, 2014
1 parent 357f26f commit 4bbdf55
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/handle.c
Expand Up @@ -247,6 +247,13 @@ hivex_open (const char *filename, int flags)
goto error;
}

if (off + page_size > h->size) {
SET_ERRNO (ENOTSUP,
"%s: page size %zu at 0x%zx extends beyond end of file, bad registry",
filename, page_size, off);
goto error;
}

/* Read the blocks in this page. */
size_t blkoff;
struct ntreg_hbin_block *block;
Expand Down

0 comments on commit 4bbdf55

Please sign in to comment.