From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTZ6R-0008L1-Q9 for qemu-devel@nongnu.org; Mon, 06 Jun 2011 08:40:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QTZ6N-0005XN-VK for qemu-devel@nongnu.org; Mon, 06 Jun 2011 08:40:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:24329) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QTZ6N-0005Wr-AH for qemu-devel@nongnu.org; Mon, 06 Jun 2011 08:40:15 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p56CeEpe021364 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 6 Jun 2011 08:40:14 -0400 From: Gerd Hoffmann Date: Mon, 6 Jun 2011 14:39:13 +0200 Message-Id: <1307363962-27223-23-git-send-email-kraxel@redhat.com> In-Reply-To: <1307363962-27223-1-git-send-email-kraxel@redhat.com> References: <1307363962-27223-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH 22/31] 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 , Gerd Hoffmann From: Hans de Goede So that we don't index endp_table with a negative index. Signed-off-by: Gerd Hoffmann --- usb-linux.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/usb-linux.c b/usb-linux.c index 4c6c284..82c1e7d 100644 --- a/usb-linux.c +++ b/usb-linux.c @@ -1030,6 +1030,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.1