Don't write outside the array in SetupDiGetClassDevPropertySheetsW
Modified: trunk/reactos/lib/setupapi/devinst.c
_____
Modified: trunk/reactos/lib/setupapi/devinst.c
--- trunk/reactos/lib/setupapi/devinst.c 2005-12-01 00:07:35 UTC
(rev 19793)
+++ trunk/reactos/lib/setupapi/devinst.c 2005-12-01 10:52:16 UTC
(rev 19794)
@@ -3733,14 +3733,14 @@
Request.DeviceInfoSet = DeviceInfoSet;
Request.DeviceInfoData = DeviceInfoData;
PropPageData.PropertySheetPages =
&PropertySheetHeader->phpage[PropertySheetHeader->nPages];
- PropPageData.MaximumNumberOfPages =
PropertySheetHeaderPageListSize;
+ PropPageData.MaximumNumberOfPages =
PropertySheetHeaderPageListSize - PropertySheetHeader->nPages;
PropPageData.NumberOfPages = 0;
ret = pPropPageProvider(&Request,
GetClassDevPropertySheetsCallback, (LPARAM)&PropPageData);
if (!ret)
goto cleanup;
if (RequiredSize)
- *RequiredSize = PropPageData.NumberOfPages;
+ *RequiredSize = PropPageData.NumberOfPages +
PropertySheetHeader->nPages;
if (PropPageData.NumberOfPages <=
PropPageData.MaximumNumberOfPages)
{
PropertySheetHeader->nPages += PropPageData.NumberOfPages;