From patchwork Tue Nov 9 07:36:53 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Out off array access in usb-net Date: Mon, 08 Nov 2010 21:36:53 -0000 From: Gleb Natapov X-Patchwork-Id: 70498 Message-Id: <20101109073653.GF9036@redhat.com> To: qemu-devel@nongnu.org Properly check array bounds before accessing array element. Signed-off-by: Gleb Natapov Reviewed-by: Paolo Bonzini --- Gleb. 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;