1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-08 03:45:57 +00:00

gdi32: NULL terminate output string in CreateDCW.

This commit is contained in:
Piotr Caban 2022-11-29 12:17:11 +01:00 committed by Alexandre Julliard
parent de3c286adf
commit b6204639ba

View File

@ -244,7 +244,7 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
{
return 0;
}
else if (output && !(port = HeapAlloc( GetProcessHeap(), 0, output_str.Length )))
else if (output && !(port = HeapAlloc( GetProcessHeap(), 0, output_str.Length + sizeof(WCHAR) )))
{
ClosePrinter( hspool );
return 0;
@ -271,7 +271,10 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
if (ret && hspool && (dc_attr = get_dc_attr( ret )))
{
if (port)
{
memcpy( port, output, output_str.Length );
port[output_str.Length / sizeof(WCHAR)] = 0;
}
dc_attr->hspool = HandleToULong( hspool );
dc_attr->output = (ULONG_PTR)port;
}