Skip to content
Snippets Groups Projects
Commit 44cd974f authored by Alexandre Julliard's avatar Alexandre Julliard
Browse files

Truncate the window text if it is too large for the request buffer.

parent d9ed57ac
No related branches found
No related tags found
No related merge requests found
......@@ -75,13 +75,15 @@ static void DEFWND_SetTextA( HWND hwnd, LPCSTR text )
if (!(wndPtr = WIN_GetPtr( hwnd ))) return;
if ((textW = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WCHAR))))
{
size_t len = min( REQUEST_MAX_VAR_SIZE, (count-1) * sizeof(WCHAR) );
if (wndPtr->text) HeapFree(GetProcessHeap(), 0, wndPtr->text);
wndPtr->text = textW;
MultiByteToWideChar( CP_ACP, 0, text, -1, textW, count );
SERVER_START_VAR_REQ( set_window_text, (count-1) * sizeof(WCHAR) )
SERVER_START_VAR_REQ( set_window_text, len )
{
req->handle = hwnd;
memcpy( server_data_ptr(req), textW, (count-1) * sizeof(WCHAR) );
memcpy( server_data_ptr(req), textW, len );
SERVER_CALL();
}
SERVER_END_VAR_REQ;
......@@ -111,11 +113,13 @@ static void DEFWND_SetTextW( HWND hwnd, LPCWSTR text )
if (wndPtr->text) HeapFree(GetProcessHeap(), 0, wndPtr->text);
if ((wndPtr->text = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WCHAR))))
{
size_t len = min( REQUEST_MAX_VAR_SIZE, (count-1) * sizeof(WCHAR) );
strcpyW( wndPtr->text, text );
SERVER_START_VAR_REQ( set_window_text, (count-1) * sizeof(WCHAR) )
SERVER_START_VAR_REQ( set_window_text, len )
{
req->handle = hwnd;
memcpy( server_data_ptr(req), wndPtr->text, (count-1) * sizeof(WCHAR) );
memcpy( server_data_ptr(req), wndPtr->text, len );
SERVER_CALL();
}
SERVER_END_VAR_REQ;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment