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 --- dlls/user32/tests/monitor.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/user32/tests/monitor.c b/dlls/user32/tests/monitor.c index 85fb2f080a7..57d2ec0008c 100644 --- a/dlls/user32/tests/monitor.c +++ b/dlls/user32/tests/monitor.c @@ -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());