]> git.proxmox.com Git - qemu.git/commitdiff
Out off array access in usb-net
authorGleb Natapov <gleb@redhat.com>
Tue, 9 Nov 2010 07:36:53 +0000 (09:36 +0200)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 16 Nov 2010 20:35:00 +0000 (14:35 -0600)
Properly check array bounds before accessing array element.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/usb-net.c

index 70f9263291aa2b9cd8cadf816c7e515723ea71cd..58c672f426b6e57eac4e058d7bed7cdd55c425ba 100644 (file)
@@ -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;