usb: sanity check setup_index+setup_len in post_load

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
Gerd Hoffmann 2013-08-28 17:09:30 +02:00
parent 94c2b6aff4
commit c60174e847
1 changed files with 4 additions and 0 deletions

View File

@ -47,6 +47,10 @@ static int usb_device_post_load(void *opaque, int version_id)
} else {
dev->attached = 1;
}
if (dev->setup_index >= sizeof(dev->data_buf) ||
dev->setup_len >= sizeof(dev->data_buf)) {
return -EINVAL;
}
return 0;
}