Commit 8be5dd16 authored by Patrick Rudolph's avatar Patrick Rudolph Committed by Alexandre Julliard

user32: Check for valid cbSize in GetMonitorInfoA.

parent 12dc23db
......@@ -419,6 +419,9 @@ BOOL WINAPI GetMonitorInfoA(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
MONITORINFOEXA *miA = (MONITORINFOEXA*)lpMonitorInfo;
BOOL ret;
if((miA->cbSize != sizeof(MONITORINFOEXA)) && (miA->cbSize != sizeof(MONITORINFO)))
return FALSE;
miW.cbSize = sizeof(miW);
ret = GetMonitorInfoW(hMonitor, (MONITORINFO*)&miW);
......@@ -427,7 +430,7 @@ BOOL WINAPI GetMonitorInfoA(HMONITOR hMonitor, LPMONITORINFO lpMonitorInfo)
miA->rcMonitor = miW.rcMonitor;
miA->rcWork = miW.rcWork;
miA->dwFlags = miW.dwFlags;
if(miA->cbSize >= offsetof(MONITORINFOEXA, szDevice) + sizeof(miA->szDevice))
if(miA->cbSize == sizeof(MONITORINFOEXA))
WideCharToMultiByte(CP_ACP, 0, miW.szDevice, -1, miA->szDevice, sizeof(miA->szDevice), NULL, NULL);
return ret;
}
......
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