[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH hivex 14/19] lib: get_children: Add additional check that each child is an nk block.



From: "Richard W.M. Jones" <rjones redhat com>

---
 lib/node.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lib/node.c b/lib/node.c
index 08b8914..55dde13 100644
--- a/lib/node.c
+++ b/lib/node.c
@@ -387,6 +387,15 @@ check_child_is_nk_block (hive_h *h, hive_node_h child, int flags)
     return -1;
   }
 
+  struct ntreg_hbin_block *block =
+    (struct ntreg_hbin_block *) ((char *) h->addr + child);
+
+  if (!BLOCK_ID_EQ (h, child, "nk")) {
+    SET_ERRNO (EFAULT, "subkey is not an 'nk' block (0x%zx, %d, %d)",
+               child, block->id[0], block->id[1]);
+    return -1;
+  }
+
   return 0;
 }
 
-- 
1.8.3.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]