From 586e92b335a98dcfbb4a797eb744753038da4374 Mon Sep 17 00:00:00 2001 From: Michael S. Tsirkin Date: Wed, 14 May 2014 08:26:14 +0200 Subject: [PATCH 14/30] usb: sanity check setup_index+setup_len in post_load RH-Author: Michael S. Tsirkin Message-id: <1400055942-6418-1-git-send-email-mst@redhat.com> Patchwork-id: 58853 O-Subject: [PATCH qemu-kvm RHEL7.0.z 1/2] usb: sanity check setup_index+setup_len in post_load Bugzilla: 1095746 RH-Acked-by: Marcel Apfelbaum RH-Acked-by: Paolo Bonzini RH-Acked-by: Gerd Hoffmann From: Gerd Hoffmann Signed-off-by: Gerd Hoffmann (cherry picked from commit c60174e847082ab9f70720f86509a3353f816fad) Brew build: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7450401 Tested: lightly on developer's box Bugzilla: 1095743 --- hw/usb/bus.c | 4 ++++ 1 file changed, 4 insertions(+) Signed-off-by: Miroslav Rezanina --- hw/usb/bus.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/hw/usb/bus.c b/hw/usb/bus.c index fe6bd13..e0c3a77 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -49,6 +49,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; } -- 1.7.1