btrfs-progs: sanitize - Use correct source for memcpy
authorGoldwyn Rodrigues <rgoldwyn@suse.com>
Fri, 20 Jan 2017 19:03:33 +0000 (13:03 -0600)
committerDavid Sterba <dsterba@suse.com>
Wed, 25 Jan 2017 08:48:06 +0000 (09:48 +0100)
While performing a memcpy, we are copying from uninitialized dst
as opposed to src->data. Though using eb->len is correct, I used
src->len to make it more readable.

Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
image/main.c

index 58dcecb..0158844 100644 (file)
@@ -550,7 +550,7 @@ static void sanitize_name(struct metadump_struct *md, u8 *dst,
                return;
        }
 
-       memcpy(eb->data, dst, eb->len);
+       memcpy(eb->data, src->data, src->len);
 
        switch (key->type) {
        case BTRFS_DIR_ITEM_KEY: