Hivex - Trailing garbage at the end of hive file
by Richard W.M. Jones
[Forwarding to the proper list]
We use hivex for one of our projects and I see the following diff committed to the hivex project (source link provided) that ignores trailing garbage. But this code has been reverted to no ignore this condition in later version of hivex
- /* This error is seemingly common in uncorrupt registry files. */
- /*
- fprintf (stderr, "hivex: %s: ignoring trailing garbage at end of file (at %zu, after %zu pages)\n",
- filename, off, h->pages);
- */
+ /* NB: This error is seemingly common in uncorrupt registry files. */
+ if (h->msglvl >= 2)
+ fprintf (stderr, "hivex: %s: ignoring trailing garbage at end of file (at %zu, after %zu pages)\n",
+ filename, off, h->pages);
Break;
http://git.annexia.org/?p=hivex.git;a=commitdiff;h=5439842dc591accbf620a5...
In your experience, is this a common condition seen in some windows hive files and is it safe to ignore when this condition is encountered?
Thanks
~ Hari
---------
--
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
11 years, 1 month
[PATCHp2v v2] virt-p2v-server: Die with the correct error message.
by Richard W.M. Jones
From: "Richard W.M. Jones" <rjones(a)redhat.com>
Although the code is technically correct (because the successful call
to $g->close won't overwrite $@ and because guestfs_close can never
fail) it's still confusing to assign $err = $@ and then not use $err.
Die with $err. It's possible something added here could overwrite $@
at some later time.
---
p2v/server/virt-p2v-server.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/p2v/server/virt-p2v-server.pl b/p2v/server/virt-p2v-server.pl
index c15efb2..0121ab2 100755
--- a/p2v/server/virt-p2v-server.pl
+++ b/p2v/server/virt-p2v-server.pl
@@ -405,7 +405,7 @@ sub convert
my $err = $@;
$g->close() if defined($g);
- die($@);
+ die($err);
}
p2v_return_ok();
--
1.8.3.1
11 years, 1 month
[PATCHp2v] virt-p2v-server: Die with the correct error message.
by Richard W.M. Jones
From: "Richard W.M. Jones" <rjones(a)redhat.com>
This caused the real error to be hidden, resulting in the
famous and uninformative:
virt-v2v: Died at /usr/bin/virt-p2v-server line 404, <> line 7.
---
p2v/server/virt-p2v-server.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/p2v/server/virt-p2v-server.pl b/p2v/server/virt-p2v-server.pl
index c15efb2..0121ab2 100755
--- a/p2v/server/virt-p2v-server.pl
+++ b/p2v/server/virt-p2v-server.pl
@@ -405,7 +405,7 @@ sub convert
my $err = $@;
$g->close() if defined($g);
- die($@);
+ die($err);
}
p2v_return_ok();
--
1.8.3.1
11 years, 1 month