user32/tests: Zero initialize DEVMODE before passing it to EnumDisplaySettings().

Zero initialize DEVMODE before passing it to EnumDisplaySettings(), which may write beyond the end
of the DEVMODE structure on Windows because the dmDriverExtra field is uninitialized.

Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2020-08-11 18:15:28 +08:00 committed by Alexandre Julliard
parent ee1880a756
commit 6d68c38c88
1 changed files with 1 additions and 0 deletions

View File

@ -514,6 +514,7 @@ static void test_ChangeDisplaySettingsEx(void)
devices[device_count].index = device;
lstrcpyA(devices[device_count].name, dd.DeviceName);
memset(&devices[device_count].original_mode, 0, sizeof(devices[device_count].original_mode));
devices[device_count].original_mode.dmSize = sizeof(devices[device_count].original_mode);
res = EnumDisplaySettingsA(dd.DeviceName, ENUM_CURRENT_SETTINGS, &devices[device_count].original_mode);
ok(res, "EnumDisplaySettingsA %s failed, error %#x\n", dd.DeviceName, GetLastError());