From patchwork Fri Jan 20 19:03:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Goldwyn Rodrigues X-Patchwork-Id: 9529289 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C944F60434 for ; Fri, 20 Jan 2017 19:04:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B87EF2868F for ; Fri, 20 Jan 2017 19:04:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A9E71286B6; Fri, 20 Jan 2017 19:04:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 40C032868F for ; Fri, 20 Jan 2017 19:04:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752630AbdATTEE (ORCPT ); Fri, 20 Jan 2017 14:04:04 -0500 Received: from mx2.suse.de ([195.135.220.15]:60551 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752101AbdATTEE (ORCPT ); Fri, 20 Jan 2017 14:04:04 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id B75D2AB5D for ; Fri, 20 Jan 2017 19:04:01 +0000 (UTC) From: Goldwyn Rodrigues To: linux-btrfs@vger.kernel.org Cc: Goldwyn Rodrigues Subject: [PATCH] btrfs-progs: sanitize - Use correct source for memcpy Date: Fri, 20 Jan 2017 13:03:33 -0600 Message-Id: <20170120190333.17737-1-rgoldwyn@suse.de> X-Mailer: git-send-email 2.10.2 Sender: linux-btrfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-btrfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Goldwyn Rodrigues 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 --- image/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image/main.c b/image/main.c index 58dcecb..0158844 100644 --- a/image/main.c +++ b/image/main.c @@ -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: