aboutsummaryrefslogtreecommitdiff
path: root/hw/usb
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-08-28 17:09:30 +0200
committerGerd Hoffmann <kraxel@redhat.com>2013-09-10 11:14:41 +0200
commitc60174e847082ab9f70720f86509a3353f816fad (patch)
treea1090bdfffccfe8b0864282df7935c8ab7b1b1f3 /hw/usb
parent94c2b6aff43cdfcfdfb552773a6b6b973a72ef0b (diff)
usb: sanity check setup_index+setup_len in post_load
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r--hw/usb/bus.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 82ca6a13e8..72d5b92225 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -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;
}