s3:registry/regfio fix some valgrind warnings
authorChristian Ambach <ambi@samba.org>
Tue, 4 Nov 2014 22:50:07 +0000 (23:50 +0100)
committerKarolin Seeger <kseeger@samba.org>
Thu, 18 Dec 2014 20:30:06 +0000 (21:30 +0100)
Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 4b41489901b7f1a78ffd479128c3e0d309e53b53)

source3/registry/regfio.c

index 41d60c7930491dc8967b59fe40d22857525122db..90191a645bfc04aa65591c2d7b3eac3ee41c3bc2 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++;