[Libguestfs] [PATCH 13/13] hivex: Fix calculation of block size for vk data blocks.

Richard W.M. Jones rjones at redhat.com
Thu Jan 28 10:21:23 UTC 2010


-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming blog: http://rwmj.wordpress.com
Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-------------- next part --------------
>From 57838e1803df4ab50e11cd89c4f85f760d5c01dc Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones at redhat.com>
Date: Thu, 21 Jan 2010 17:07:42 +0000
Subject: [PATCH 13/13] hivex: Fix calculation of block size for vk data blocks.

---
 hivex/hivex.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hivex/hivex.c b/hivex/hivex.c
index 4e67b55..43d5788 100644
--- a/hivex/hivex.c
+++ b/hivex/hivex.c
@@ -1211,7 +1211,7 @@ hivex_value_value (hive_h *h, hive_value_h value,
 
   /* Check that the declared size isn't larger than the block its in. */
   size_t blen = block_len (h, data_offset, NULL);
-  if (len > blen) {
+  if (len > blen - 4 /* subtract 4 for block header */) {
     if (h->msglvl >= 2)
       fprintf (stderr, "hivex_value_value: returning EFAULT because data is longer than its block (data 0x%zx, data len %zu, block len %zu)\n",
                data_offset, len, blen);
-- 
1.6.5.2



More information about the Libguestfs mailing list