Blame SOURCES/0002-handle-Check-that-pages-do-not-extend-beyond-the-end.patch

40f388
From 4bbdf555f88baeae0fa804a369a81a83908bd705 Mon Sep 17 00:00:00 2001
40f388
From: "Richard W.M. Jones" <rjones@redhat.com>
40f388
Date: Thu, 30 Oct 2014 14:02:25 +0000
40f388
Subject: [PATCH 2/2] handle: Check that pages do not extend beyond the end of
40f388
 the file.
40f388
40f388
Thanks: Mahmoud Al-Qudsi
40f388
---
40f388
 lib/handle.c | 7 +++++++
40f388
 1 file changed, 7 insertions(+)
40f388
40f388
diff --git a/lib/handle.c b/lib/handle.c
40f388
index a3cbcf7..3a8f09b 100644
40f388
--- a/lib/handle.c
40f388
+++ b/lib/handle.c
40f388
@@ -247,6 +247,13 @@ hivex_open (const char *filename, int flags)
40f388
       goto error;
40f388
     }
40f388
 
40f388
+    if (off + page_size > h->size) {
40f388
+      SET_ERRNO (ENOTSUP,
40f388
+                 "%s: page size %zu at 0x%zx extends beyond end of file, bad registry",
40f388
+                 filename, page_size, off);
40f388
+      goto error;
40f388
+    }
40f388
+
40f388
     /* Read the blocks in this page. */
40f388
     size_t blkoff;
40f388
     struct ntreg_hbin_block *block;
40f388
-- 
40f388
2.1.0
40f388