mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 09:34:43 +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)
|
||||
{
|
||||
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 );
|
||||
pdphdr->pdmOut->dmDeviceName[CCHDEVICENAME-1] = 0;
|
||||
}
|
||||
|
@ -842,6 +854,8 @@ IntFixUpDevModeNames( PDOCUMENTPROPERTYHEADER pdphdr )
|
|||
{
|
||||
ERR("IFUDMN : GetPrinterW failed with %u\n", GetLastError());
|
||||
}
|
||||
|
||||
Exit:
|
||||
HeapFree(hProcessHeap, 0, pi2);
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue