mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
[WINSPOOL] Properly copy the DEVMODE in IntFixUpDevModeNames
Otherwise the size isn't set up correctly, leading to a crash. Fixes crash in comdl32_winetest printdlg.
This commit is contained in:
parent
8c76870639
commit
02df49ebd8
1 changed files with 15 additions and 1 deletions
|
@ -834,7 +834,19 @@ IntFixUpDevModeNames( PDOCUMENTPROPERTYHEADER pdphdr )
|
||||||
|
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
FIXME("IFUDMN : Get Printer Name %S\n",pi2->pPrinterName);
|
/* Check if the provided buffer is large enough */
|
||||||
|
DWORD cbDevMode = pi2->pDevMode->dmSize + pi2->pDevMode->dmDriverExtra;
|
||||||
|
if (pdphdr->cbOut < cbDevMode)
|
||||||
|
{
|
||||||
|
ERR("cbOut (%lu) < cbDevMode(%u)\n", pdphdr->cbOut, cbDevMode);
|
||||||
|
res = FALSE;
|
||||||
|
goto Exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Copy the devmode */
|
||||||
|
RtlCopyMemory(pdphdr->pdmOut, pi2->pDevMode, cbDevMode);
|
||||||
|
|
||||||
|
TRACE("IFUDMN : Get Printer Name %S\n", pi2->pPrinterName);
|
||||||
StringCchCopyW( pdphdr->pdmOut->dmDeviceName, CCHDEVICENAME-1, pi2->pPrinterName );
|
StringCchCopyW( pdphdr->pdmOut->dmDeviceName, CCHDEVICENAME-1, pi2->pPrinterName );
|
||||||
pdphdr->pdmOut->dmDeviceName[CCHDEVICENAME-1] = 0;
|
pdphdr->pdmOut->dmDeviceName[CCHDEVICENAME-1] = 0;
|
||||||
}
|
}
|
||||||
|
@ -842,6 +854,8 @@ IntFixUpDevModeNames( PDOCUMENTPROPERTYHEADER pdphdr )
|
||||||
{
|
{
|
||||||
ERR("IFUDMN : GetPrinterW failed with %u\n", GetLastError());
|
ERR("IFUDMN : GetPrinterW failed with %u\n", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Exit:
|
||||||
HeapFree(hProcessHeap, 0, pi2);
|
HeapFree(hProcessHeap, 0, pi2);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue