Module: wine Branch: master Commit: 8e73b48f343e45100f71f51ef3c02fc4bbef2ed0 URL: https://gitlab.winehq.org/wine/wine/-/commit/8e73b48f343e45100f71f51ef3c02fc...
Author: Esme Povirk esme@codeweavers.com Date: Fri Dec 17 14:45:51 2021 -0600
win32u: Reject invalid length in SetWindowPlacement.
---
dlls/user32/tests/win.c | 2 -- dlls/win32u/window.c | 5 +++++ 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index d70f8a0cafd..d9b1d9c2665 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -12504,10 +12504,8 @@ static void test_window_placement(void) wp.length = 0; SetLastError(0xdeadbeef); ret = SetWindowPlacement(hwnd, &wp); -todo_wine { ok(!ret, "SetWindowPlacement should have failed\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %lu\n", GetLastError()); -}
DestroyWindow(hwnd); } diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index d7263875b17..5b87dcdf465 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2567,6 +2567,11 @@ BOOL WINAPI NtUserSetWindowPlacement( HWND hwnd, const WINDOWPLACEMENT *wpl ) { UINT flags = PLACE_MAX | PLACE_RECT; if (!wpl) return FALSE; + if (wpl->length != sizeof(*wpl)) + { + RtlSetLastWin32Error( ERROR_INVALID_PARAMETER ); + return FALSE; + } if (wpl->flags & WPF_SETMINPOSITION) flags |= PLACE_MIN; return set_window_placement( hwnd, wpl, flags ); }