Fix trailing garbage in the hbin block.
authorWilco Baan Hofman <wilco@baanhofman.nl>
Thu, 8 Oct 2009 10:36:30 +0000 (12:36 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Sun, 15 Nov 2009 18:26:50 +0000 (19:26 +0100)
This specifically fixes a problem showing extra bytes of garbage in list and
print in regshell, even though the vk.data_length has the correct size.

Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
source4/lib/registry/regf.c

index c5a74c79115916e89a6d3429be5b10cb8c01e3cf..a7fed4205403d3725ef5ee49357105fc357bb7e0 100644 (file)
@@ -261,6 +261,11 @@ static uint32_t hbin_store (struct regf_data *data, DATA_BLOB blob)
 
        memcpy(dest.data, blob.data, blob.length);
 
+       /* Make sure that we have no tailing garbage in the block */
+       if (dest.length > blob.length) {
+               memset(dest.data + blob.length, 0, dest.length - blob.length);
+       }
+
        return ret;
 }