Commit b6204639 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

gdi32: NULL terminate output string in CreateDCW.

parent de3c286a
...@@ -244,7 +244,7 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output, ...@@ -244,7 +244,7 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
{ {
return 0; 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 ); ClosePrinter( hspool );
return 0; return 0;
...@@ -271,7 +271,10 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output, ...@@ -271,7 +271,10 @@ HDC WINAPI CreateDCW( LPCWSTR driver, LPCWSTR device, LPCWSTR output,
if (ret && hspool && (dc_attr = get_dc_attr( ret ))) if (ret && hspool && (dc_attr = get_dc_attr( ret )))
{ {
if (port) if (port)
{
memcpy( port, output, output_str.Length ); memcpy( port, output, output_str.Length );
port[output_str.Length / sizeof(WCHAR)] = 0;
}
dc_attr->hspool = HandleToULong( hspool ); dc_attr->hspool = HandleToULong( hspool );
dc_attr->output = (ULONG_PTR)port; dc_attr->output = (ULONG_PTR)port;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment