From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=40873 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFilK-0001WR-O2 for qemu-devel@nongnu.org; Tue, 09 Nov 2010 02:37:07 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PFilE-0000fq-LA for qemu-devel@nongnu.org; Tue, 09 Nov 2010 02:37:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:58932) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PFilE-0000fZ-EO for qemu-devel@nongnu.org; Tue, 09 Nov 2010 02:36:56 -0500 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.13.8/8.13.8) with ESMTP id oA97atde020599 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 9 Nov 2010 02:36:55 -0500 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id oA97asJR017800 for ; Tue, 9 Nov 2010 02:36:54 -0500 Date: Tue, 9 Nov 2010 09:36:53 +0200 From: Gleb Natapov Message-ID: <20101109073653.GF9036@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] Out off array access in usb-net List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Properly check array bounds before accessing array element. Signed-off-by: Gleb Natapov diff --git a/hw/usb-net.c b/hw/usb-net.c index 70f9263..84e2d79 100644 --- a/hw/usb-net.c +++ b/hw/usb-net.c @@ -1142,7 +1142,7 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value, break; default: - if (usb_net_stringtable[value & 0xff]) { + if (ARRAY_SIZE(usb_net_stringtable) > (value & 0xff)) { ret = set_usb_string(data, usb_net_stringtable[value & 0xff]); break; -- Gleb.