From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XUafI-0007PO-DG for qemu-devel@nongnu.org; Thu, 18 Sep 2014 08:18:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XUafE-0005gz-8L for qemu-devel@nongnu.org; Thu, 18 Sep 2014 08:18:24 -0400 Message-ID: <541ACD75.1040708@redhat.com> Date: Thu, 18 Sep 2014 06:17:57 -0600 From: Eric Blake MIME-Version: 1.0 References: <1411011222-5116-1-git-send-email-zhang.zhanghailiang@huawei.com> In-Reply-To: <1411011222-5116-1-git-send-email-zhang.zhanghailiang@huawei.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="kPcttdM06i1NB11eiU6PD1DuuON0xEIMM" Subject: Re: [Qemu-devel] [PATCH] qga: Fix possible freed memory accessing List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: zhanghailiang , qemu-devel@nongnu.org Cc: mdroth@linux.vnet.ibm.com, armbru@redhat.com, luonengjun@huawei.com, peter.huangpeng@huawei.com, qemu-stable@nongnu.org, lcapitulino@redhat.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --kPcttdM06i1NB11eiU6PD1DuuON0xEIMM Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/17/2014 09:33 PM, zhanghailiang wrote: > If readdir_r fails, error_setg_errno will reference the freed > pointer *dirpath*. >=20 > Signed-off-by: zhanghailiang > --- > qga/commands-posix.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > for (;;) { > if (readdir_r(dir, &entry, &result) !=3D 0) { Eww. We're using readdir_r? That's an inherently broken interface, which can risk buffer overflow. readdir should be preferred. http://austingroupbugs.net/view.php?id=3D696 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --kPcttdM06i1NB11eiU6PD1DuuON0xEIMM Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg iQEcBAEBCAAGBQJUGs11AAoJEKeha0olJ0Nq4UkH/1laKX3JfYnG1RjrS+eaj4kM R29nE8B1yq60OjkhhZyh31hdrLX+JxrCnYF83VNHG7WCQd2wrJLsIAS1cYJSgY0U /d5D/5ZpWgq/dmTgk/ZjIL27UdCPDz6EGG6DtpiPrydp/oYnBZT1F9WJNWTr7K5J YBcTZuxHZhbiX5ATzukAiQCrYYexXtoH2rCRQj/mdcYbh41JS2S+S7a/sPSQcP6R cCkhI5GZk0hgAHcVSyjTkmd9slUkuF4zSfsdnwtqgxUtVZsHTORHOZkuVbgwuV06 xjY360OQaH9YUvG4AAq/thZuc34+1xyLwJAhngCT5Dct6CuzXOeoC5aeLWvmi4M= =zh3g -----END PGP SIGNATURE----- --kPcttdM06i1NB11eiU6PD1DuuON0xEIMM--