[Libguestfs] [PATCH 3/3] hivex: Fix for endianess bug.
Richard W.M. Jones
rjones at redhat.com
Thu May 12 08:01:28 UTC 2011
On Thu, May 12, 2011 at 12:04:20AM +0200, bengen at hilluzination.de wrote:
> From: Hilko Bengen <bengen at hilluzination.de>
>
> * Richard W.M. Jones:
> > > Both size_t and int are 32 bit values. An endianess issue, maybe?
> > I guess it might be. We're supposed to be doing le32toh / be32toh
> > everywhere as appropriate, but we might be missing one. The code is
> > mainly tested on little endian arches.
>
> Found it.
>
> Now "make check" completes successfully on Sparc and PowerPC.
> ---
> lib/hivex.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/lib/hivex.c b/lib/hivex.c
> index 2abd5bd..7715520 100644
> --- a/lib/hivex.c
> +++ b/lib/hivex.c
> @@ -1062,7 +1062,7 @@ get_values (hive_h *h, hive_node_h node,
>
> size_t i;
> for (i = 0; i < nr_values; ++i) {
> - hive_node_h value = vlist->offset[i];
> + hive_node_h value = le32toh (vlist->offset[i]);
> value += 0x1000;
> if (!IS_VALID_BLOCK (h, value)) {
> if (h->msglvl >= 2)
> --
> 1.7.5.1
Very good catch!
I'll push this later on today.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
libguestfs lets you edit virtual machines. Supports shell scripting,
bindings from many languages. http://libguestfs.org
More information about the Libguestfs
mailing list