s3:registry/regfio fix some valgrind warnings
authorChristian Ambach <ambi@samba.org>
Tue, 4 Nov 2014 22:50:07 +0000 (23:50 +0100)
committerChristian Ambach <ambi@samba.org>
Tue, 2 Dec 2014 21:21:06 +0000 (22:21 +0100)
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
source3/registry/regfio.c

index b32bf0314df089201bd5e72a44b1358516e6125a..e49de2625e5c41a73e0ef02587172fdfeaeb50cd 100644 (file)
@@ -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++;