[Libguestfs] [PATCH 1/2] lib: change how hbin sections are read.
Richard W.M. Jones
rjones at redhat.com
Tue Feb 14 14:28:50 UTC 2017
On Wed, Feb 08, 2017 at 04:36:30PM -0500, Dawid Zamirski wrote:
> * hivex_open: when looping over hbin sections (aka pages), handle a
> case where following hbin section may not begin at exactly at the end
> of previous one. If this happens, scan the page section until next
> one is found and validate it by checking declared offset with actual
> one - if they match, all is good and we can safely move on.
>
> Rationale: there are registry hives there is some garbage data between
> hbin section but the hive is still perfectly usable as long as the
> offsets stated in hbin headers are correct.
> ---
> lib/handle.c | 39 ++++++++++++++++++++++++++++++++++-----
> 1 file changed, 34 insertions(+), 5 deletions(-)
>
> diff --git a/lib/handle.c b/lib/handle.c
> index 4565d7d..1e122ea 100644
> --- a/lib/handle.c
> +++ b/lib/handle.c
> @@ -226,11 +226,30 @@ hivex_open (const char *filename, int flags)
> page->magic[1] != 'b' ||
> page->magic[2] != 'i' ||
> page->magic[3] != 'n') {
> - SET_ERRNO (ENOTSUP,
> - "%s: trailing garbage at end of file "
> - "(at 0x%zx, after %zu pages)",
> - filename, off, pages);
> - goto error;
> +
> + DEBUG(2,
Please put spaces after function and macro calls (throughout).
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
More information about the Libguestfs
mailing list