diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 699aa1075d0b1e33aab7c8ce5f3e1672dd8cbd56..927a47bbff0e4997e9b109e30a83a513290f29c1 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -51,8 +51,8 @@ static int usb_device_post_load(void *opaque, int version_id) } if (dev->setup_index < 0 || dev->setup_len < 0 || - dev->setup_index >= sizeof(dev->data_buf) || - dev->setup_len >= sizeof(dev->data_buf)) { + dev->setup_index > dev->setup_len || + dev->setup_len > sizeof(dev->data_buf)) { return -EINVAL; } return 0;