From 155818fc70589d9b3799c0c19a25a6afb11283cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 29 Jul 2016 13:44:37 +0000 Subject: [PATCH] [PCIX] Fix Device_SaveCurrentSettings: do not reference BarArray too soon if the index is out of bounds (in that case it means we are handling a ROM "BAR"). CID 716153, reported by Victor Martinez Calvo. CORE-11215 #resolve svn path=/trunk/; revision=72050 --- reactos/drivers/bus/pcix/device.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/reactos/drivers/bus/pcix/device.c b/reactos/drivers/bus/pcix/device.c index 998533b4415..a860cb2be05 100644 --- a/reactos/drivers/bus/pcix/device.c +++ b/reactos/drivers/bus/pcix/device.c @@ -46,12 +46,12 @@ Device_SaveCurrentSettings(IN PPCI_CONFIGURATOR_CONTEXT Context) CmDescriptor->u.Generic.Start.HighPart = 0; CmDescriptor->u.Generic.Length = IoDescriptor->u.Generic.Length; - /* Read the actual BAR value */ - Bar = BarArray[i]; - - /* Check which BAR is being processed now */ - if (i != PCI_TYPE0_ADDRESSES) + /* Check if we're handling PCI BARs, or the ROM BAR */ + if (i < PCI_TYPE0_ADDRESSES) { + /* Read the actual BAR value */ + Bar = BarArray[i]; + /* Check if this is an I/O BAR */ if (Bar & PCI_ADDRESS_IO_SPACE) {