From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1clGqq-0001gn-MG for qemu-devel@nongnu.org; Tue, 07 Mar 2017 10:16:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1clGqn-0001k1-Hs for qemu-devel@nongnu.org; Tue, 07 Mar 2017 10:16:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39352) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1clGqn-0001jq-BL for qemu-devel@nongnu.org; Tue, 07 Mar 2017 10:16:33 -0500 From: Eric Blake Date: Tue, 7 Mar 2017 09:16:27 -0600 Message-Id: <20170307151627.27212-1-eblake@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH for-2.9 v2] nbd/client: fix drop_sync [CVE-2017-2630] List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, vsementsov@virtuozzo.com, f4bug@amsat.org From: Vladimir Sementsov-Ogievskiy Comparison symbol is misused. It may lead to memory corruption. Introduced in commit 7d3123e. Signed-off-by: Vladimir Sementsov-Ogievskiy Message-Id: <20170203154757.36140-6-vsementsov@virtuozzo.com> [eblake: add CVE details, update conditional] Signed-off-by: Eric Blake Reviewed-by: Marc-Andr=C3=A9 Lureau --- v2: use >=3D instead of >, fix R-b --- nbd/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nbd/client.c b/nbd/client.c index 5c9dee3..3dc2564 100644 --- a/nbd/client.c +++ b/nbd/client.c @@ -94,7 +94,7 @@ static ssize_t drop_sync(QIOChannel *ioc, size_t size) char small[1024]; char *buffer; - buffer =3D sizeof(small) < size ? small : g_malloc(MIN(65536, size))= ; + buffer =3D sizeof(small) >=3D size ? small : g_malloc(MIN(65536, siz= e)); while (size > 0) { ssize_t count =3D read_sync(ioc, buffer, MIN(65536, size)); --=20 2.9.3