Received: from eggs.gnu.org ([140.186.70.92]:48705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRLML-0005O3-W7 for qemu-devel@nongnu.org; Tue, 31 May 2011 05:35:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QRLML-0002kq-5W for qemu-devel@nongnu.org; Tue, 31 May 2011 05:35:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13899) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QRLMK-0002kk-Ul for qemu-devel@nongnu.org; Tue, 31 May 2011 05:35:33 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p4V9ZWoV022775 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 31 May 2011 05:35:32 -0400 From: Hans de Goede Date: Tue, 31 May 2011 11:35:22 +0200 Message-Id: <1306834530-12763-7-git-send-email-hdegoede@redhat.com> In-Reply-To: <1306834530-12763-1-git-send-email-hdegoede@redhat.com> References: <1306834530-12763-1-git-send-email-hdegoede@redhat.com> Subject: [Qemu-devel] [PATCH 06/14] usb-linux: Ensure devep != 0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Hans de Goede So that we don't index endp_table with a negative index. --- usb-linux.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/usb-linux.c b/usb-linux.c index 544aea3..e2f45d3 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -1029,6 +1029,11 @@ static int usb_linux_update_endp_table(USBHostDevice *s) } devep = descriptors[i + 2]; + if ((devep & 0x0f) == 0) { + fprintf(stderr, "usb-linux: invalid ep descriptor, ep == 0\n"); + return 1; + } + switch (descriptors[i + 3] & 0x3) { case 0x00: type = USBDEVFS_URB_TYPE_CONTROL; -- 1.7.5.1