[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 17:35:12 UTC 2010


On Thu, Jan 28, 2010 at 06:32:47PM +0100, Jim Meyering wrote:
> Richard W.M. Jones wrote:
> > Subject: [PATCH 13/13] hivex: Fix calculation of block size for vk data blocks.
> > diff --git a/hivex/hivex.c b/hivex/hivex.c
> ...
> >    /* 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 */) {
> 
> I presume there's no symbolic (e.g., sizeof-related) way to get that "4".
> ACK.

It's fairly well baked into the format.  Microsoft didn't change the
hive format even when they ported Windows to 64 bit, even though the
registry is just a memory dump ...

Oh this format is horrible.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list