]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/extra/0022-9pfs-use-g_malloc0-to-allocate-space-for-xattr.patch
bump version to 2.9.1-9
[pve-qemu.git] / debian / patches / extra / 0022-9pfs-use-g_malloc0-to-allocate-space-for-xattr.patch
CommitLineData
3dcc8d3b 1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
c53dfb57
WB
2From: Prasad J Pandit <pjp@fedoraproject.org>
3Date: Mon, 16 Oct 2017 14:21:59 +0200
3dcc8d3b 4Subject: [PATCH] 9pfs: use g_malloc0 to allocate space for xattr
c53dfb57
WB
5
69p back-end first queries the size of an extended attribute,
7allocates space for it via g_malloc() and then retrieves its
8value into allocated buffer. Race between querying attribute
9size and retrieving its could lead to memory bytes disclosure.
10Use g_malloc0() to avoid it.
11
12Reported-by: Tuomas Tynkkynen <tuomas.tynkkynen@iki.fi>
13Signed-off-by: Prasad J Pandit <pjp@fedoraproject.org>
14Signed-off-by: Greg Kurz <groug@kaod.org>
15---
16 hw/9pfs/9p.c | 4 ++--
17 1 file changed, 2 insertions(+), 2 deletions(-)
18
19diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
20index c80ba67389..aaf9935ef4 100644
21--- a/hw/9pfs/9p.c
22+++ b/hw/9pfs/9p.c
23@@ -3220,7 +3220,7 @@ static void coroutine_fn v9fs_xattrwalk(void *opaque)
24 xattr_fidp->fid_type = P9_FID_XATTR;
25 xattr_fidp->fs.xattr.xattrwalk_fid = true;
26 if (size) {
27- xattr_fidp->fs.xattr.value = g_malloc(size);
28+ xattr_fidp->fs.xattr.value = g_malloc0(size);
29 err = v9fs_co_llistxattr(pdu, &xattr_fidp->path,
30 xattr_fidp->fs.xattr.value,
31 xattr_fidp->fs.xattr.len);
32@@ -3253,7 +3253,7 @@ static void coroutine_fn v9fs_xattrwalk(void *opaque)
33 xattr_fidp->fid_type = P9_FID_XATTR;
34 xattr_fidp->fs.xattr.xattrwalk_fid = true;
35 if (size) {
36- xattr_fidp->fs.xattr.value = g_malloc(size);
37+ xattr_fidp->fs.xattr.value = g_malloc0(size);
38 err = v9fs_co_lgetxattr(pdu, &xattr_fidp->path,
39 &name, xattr_fidp->fs.xattr.value,
40 xattr_fidp->fs.xattr.len);
41--
422.11.0
43