From: Christian Ambach Date: Tue, 4 Nov 2014 22:50:07 +0000 (+0100) Subject: s3:registry/regfio fix some valgrind warnings X-Git-Tag: samba-4.0.26~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=997f6a93e969cd9b4e00ef7270a66e6373942517;p=thirdparty%2Fsamba.git s3:registry/regfio fix some valgrind warnings Signed-off-by: Christian Ambach Reviewed-by: Stefan Metzmacher (cherry picked from commit 4b41489901b7f1a78ffd479128c3e0d309e53b53) --- diff --git a/source3/registry/regfio.c b/source3/registry/regfio.c index 41d60c79304..90191a645bf 100644 --- a/source3/registry/regfio.c +++ b/source3/registry/regfio.c @@ -1741,7 +1741,7 @@ static bool create_vk_record(REGF_FILE *file, REGF_VK_REC *vk, /* make sure we don't try to copy from a NULL value pointer */ if ( vk->data_size != 0 ) - memcpy( &vk->data_off, regval_data_p(value), sizeof(uint32) ); + memcpy( &vk->data_off, regval_data_p(value), vk->data_size); vk->data_size |= VK_DATA_IN_OFFSET; } @@ -1806,7 +1806,7 @@ static int hashrec_cmp( REGF_HASH_REC *h1, REGF_HASH_REC *h2 ) REGF_HASH_REC *hash = &parent->subkeys.hashes[parent->subkey_index]; hash->nk_off = prs_offset( &nk->hbin->ps ) + nk->hbin->first_hbin_off - HBIN_HDR_SIZE; - memcpy( hash->keycheck, name, sizeof(uint32) ); + memcpy(hash->keycheck, name, MIN(strlen(name),sizeof(uint32))); hash->fullname = talloc_strdup( file->mem_ctx, name ); parent->subkey_index++;