From: Gonglei Date: Tue, 10 Feb 2015 07:51:23 +0000 (+0800) Subject: xen-pt: fix Out-of-bounds read X-Git-Tag: v2.3.0-rc0~32^2~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=14cec170ea4724e6881ba2febb20e88a942e52d3;p=thirdparty%2Fqemu.git xen-pt: fix Out-of-bounds read The array length of s->real_device.io_regions[] is "PCI_NUM_REGIONS - 1". Signed-off-by: Gonglei Acked-by: Stefano Stabellini Signed-off-by: Michael Tokarev --- diff --git a/hw/xen/xen_pt_config_init.c b/hw/xen/xen_pt_config_init.c index 710fe501bc5..d99c22ef2f6 100644 --- a/hw/xen/xen_pt_config_init.c +++ b/hw/xen/xen_pt_config_init.c @@ -438,7 +438,7 @@ static int xen_pt_bar_reg_read(XenPCIPassthroughState *s, XenPTReg *cfg_entry, /* get BAR index */ index = xen_pt_bar_offset_to_index(reg->offset); - if (index < 0 || index >= PCI_NUM_REGIONS) { + if (index < 0 || index >= PCI_NUM_REGIONS - 1) { XEN_PT_ERR(&s->dev, "Internal error: Invalid BAR index [%d].\n", index); return -1; }