Skip to content

Commit 4bbdf55

Browse files
committed
handle: Check that pages do not extend beyond the end of the file.
Thanks: Mahmoud Al-Qudsi
1 parent 357f26f commit 4bbdf55

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: lib/handle.c

+7
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,13 @@ hivex_open (const char *filename, int flags)
247247
goto error;
248248
}
249249

250+
if (off + page_size > h->size) {
251+
SET_ERRNO (ENOTSUP,
252+
"%s: page size %zu at 0x%zx extends beyond end of file, bad registry",
253+
filename, page_size, off);
254+
goto error;
255+
}
256+
250257
/* Read the blocks in this page. */
251258
size_t blkoff;
252259
struct ntreg_hbin_block *block;

0 commit comments

Comments
 (0)