From 53767e20b16d102937969ac3334b45e052b3eaff Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Sat, 25 Apr 2009 12:05:08 +0000 Subject: [PATCH] - Fix allocation of CM_RESOURCE_LIST - Might fix bug 4354 See issue #4354 for more details. svn path=/trunk/; revision=40694 --- reactos/drivers/video/videoprt/dispatch.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/reactos/drivers/video/videoprt/dispatch.c b/reactos/drivers/video/videoprt/dispatch.c index 0f36ad19ad0..d0642e001ff 100644 --- a/reactos/drivers/video/videoprt/dispatch.c +++ b/reactos/drivers/video/videoprt/dispatch.c @@ -340,9 +340,11 @@ IntVideoPortPnPStartDevice( /* Save the resource list */ ResourceCount = AllocatedResources->List[0].PartialResourceList.Count; - ResourceListSize = - FIELD_OFFSET(CM_RESOURCE_LIST, List[0].PartialResourceList. - PartialDescriptors[ResourceCount]); + ResourceListSize = sizeof(CM_RESOURCE_LIST); + + if (ResourceCount > 1) + ResourceListSize += (ResourceCount-1) * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR); + DeviceExtension->AllocatedResources = ExAllocatePool(PagedPool, ResourceListSize); if (DeviceExtension->AllocatedResources == NULL) {