From 45bb24e93914d2fc5253052d75ef7e43a1c2b26c Mon Sep 17 00:00:00 2001 From: Wilco Baan Hofman Date: Thu, 8 Oct 2009 12:36:30 +0200 Subject: Fix trailing garbage in the hbin block. 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 --- source4/lib/registry/regf.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'source4') diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index c5a74c7911..a7fed42054 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -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; } -- cgit