Out off array access in usb-net

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>
This commit is contained in:
Gleb Natapov 2010-11-09 09:36:53 +02:00 committed by Anthony Liguori
parent 43ae691e77
commit d59f8ba938

View File

@ -1142,7 +1142,7 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value,
break; break;
default: default:
if (usb_net_stringtable[value & 0xff]) { if (ARRAY_SIZE(usb_net_stringtable) > (value & 0xff)) {
ret = set_usb_string(data, ret = set_usb_string(data,
usb_net_stringtable[value & 0xff]); usb_net_stringtable[value & 0xff]);
break; break;