From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Gerd Hoffmann 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> Subject: [Qemu-devel] [PATCH 1/4] usb: sanity check setup_index+setup_len in post_load List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Gerd Hoffmann 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; } -- 1.8.3.1