Commit c91dd240 authored by Ken Thomases's avatar Ken Thomases Committed by Alexandre Julliard

kernel32: Avoid truncating 64-bit ullTotalPhys value to 32 bits when copying to…

kernel32: Avoid truncating 64-bit ullTotalPhys value to 32 bits when copying to ullAvailPhys, ullTotalPageFile, and ullAvailPageFile.
parent 89a96db0
......@@ -1226,11 +1226,13 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
lpmemex->ullTotalPhys = val;
mib[1] = HW_USERMEM;
size_sys = sizeof(val);
if (sysctl(mib, 2, &val, &size_sys, NULL, 0) || size_sys != sizeof(val) || !val)
val = lpmemex->ullTotalPhys;
lpmemex->ullAvailPhys = val;
lpmemex->ullTotalPageFile = val;
lpmemex->ullAvailPageFile = val;
if (!sysctl(mib, 2, &val, &size_sys, NULL, 0) && size_sys == sizeof(val) && val)
lpmemex->ullAvailPhys = val;
else
lpmemex->ullAvailPhys = lpmemex->ullTotalPhys;
lpmemex->ullTotalPageFile = lpmemex->ullAvailPhys;
lpmemex->ullAvailPageFile = lpmemex->ullAvailPhys;
#elif defined ( sun )
pagesize=sysconf(_SC_PAGESIZE);
maxpages=sysconf(_SC_PHYS_PAGES);
......
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