From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40305) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bokFj-0003vQ-55 for qemu-devel@nongnu.org; Tue, 27 Sep 2016 00:44:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bokFh-0007r0-9i for qemu-devel@nongnu.org; Tue, 27 Sep 2016 00:44:22 -0400 Received: from mail-oi0-x244.google.com ([2607:f8b0:4003:c06::244]:34376) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bokFh-0007ql-2p for qemu-devel@nongnu.org; Tue, 27 Sep 2016 00:44:21 -0400 Received: by mail-oi0-x244.google.com with SMTP id a62so170373oib.1 for ; Mon, 26 Sep 2016 21:44:20 -0700 (PDT) Message-ID: <57e9f923.05acca0a.3dec3.0ccc@mx.google.com> From: Li Qiang Date: Mon, 26 Sep 2016 21:44:10 -0700 Subject: [Qemu-devel] [PATCH] 9pfs: fix information leak in xattr read List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aneesh.kumar@linux.vnet.ibm.com, groug@kaod.org, qemu-devel@nongnu.org Cc: Li Qiang From: Li Qiang 9pfs uses g_malloc() to allocate the xattr memory space, if the guest reads this memory before writing to it, this will leak host heap memory to the guest. This patch avoid this. Signed-off-by: Li Qiang --- hw/9pfs/9p.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index b1ff8e7..4db1bd8 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -3291,7 +3291,7 @@ static void v9fs_xattrcreate(void *opaque) xattr_fidp->fs.xattr.flags = flags; v9fs_string_init(&xattr_fidp->fs.xattr.name); v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name); - xattr_fidp->fs.xattr.value = g_malloc(size); + xattr_fidp->fs.xattr.value = g_malloc0(size); err = offset; put_fid(pdu, file_fidp); out_nofid: -- 1.8.3.1