usb: sanity check setup_index+setup_len in post_load
authorGerd Hoffmann <kraxel@redhat.com>
Wed, 28 Aug 2013 15:09:30 +0000 (17:09 +0200)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 10 Sep 2013 09:14:41 +0000 (11:14 +0200)
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
hw/usb/bus.c

index 82ca6a13e8ee788c3ddde0a82adcc183796cfc6f..72d5b9222529e284daa971eb02ad5906f6272e6a 100644 (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;
 }