|
From: | Paolo Bonzini |
Subject: | [Qemu-devel] Re: [PATCH] Out off array access in usb-net |
Date: | Tue, 09 Nov 2010 10:29:54 +0100 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101027 Fedora/3.1.6-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.6 |
On 11/09/2010 08:36 AM, Gleb Natapov wrote:
Properly check array bounds before accessing array element. Signed-off-by: Gleb Natapov<address@hidden> 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.
Reviewed-by: Paolo Bonzini <address@hidden> Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |