From patchwork Tue Sep 10 09:41:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 273801 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 06F8A2C00C9 for ; Tue, 10 Sep 2013 19:42:12 +1000 (EST) Received: from localhost ([::1]:56640 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJKSX-0003SR-UY for incoming@patchwork.ozlabs.org; Tue, 10 Sep 2013 05:42:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJKRz-0003Mx-Nj for qemu-devel@nongnu.org; Tue, 10 Sep 2013 05:41:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VJKRr-0005FO-6B for qemu-devel@nongnu.org; Tue, 10 Sep 2013 05:41:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63469) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VJKRq-0005F4-Ul for qemu-devel@nongnu.org; Tue, 10 Sep 2013 05:41:27 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8A9fQIx027214 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 10 Sep 2013 05:41:26 -0400 Received: from nilsson.home.kraxel.org (vpn1-4-143.ams2.redhat.com [10.36.4.143]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r8A9fPap028943; Tue, 10 Sep 2013 05:41:25 -0400 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 8E60580701; Tue, 10 Sep 2013 11:41:24 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 10 Sep 2013 11:41:10 +0200 Message-Id: <1378806073-25197-2-git-send-email-kraxel@redhat.com> In-Reply-To: <1378806073-25197-1-git-send-email-kraxel@redhat.com> References: <1378806073-25197-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 1/4] usb: sanity check setup_index+setup_len in post_load X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Gerd Hoffmann --- hw/usb/bus.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 82ca6a1..72d5b92 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -47,6 +47,10 @@ static int usb_device_post_load(void *opaque, int version_id) } else { dev->attached = 1; } + if (dev->setup_index >= sizeof(dev->data_buf) || + dev->setup_len >= sizeof(dev->data_buf)) { + return -EINVAL; + } return 0; }