mirror of
https://github.com/reactos/wine.git
synced 2024-12-02 08:46:29 +00:00
kernel32: Check that sysctl() call succeeded before using its output.
This commit is contained in:
parent
aa22a3c4b2
commit
89a96db01f
@ -1222,12 +1222,12 @@ BOOL WINAPI GlobalMemoryStatusEx( LPMEMORYSTATUSEX lpmemex )
|
||||
mib[0] = CTL_HW;
|
||||
mib[1] = HW_PHYSMEM;
|
||||
size_sys = sizeof(val);
|
||||
sysctl(mib, 2, &val, &size_sys, NULL, 0);
|
||||
if (val) lpmemex->ullTotalPhys = val;
|
||||
if (!sysctl(mib, 2, &val, &size_sys, NULL, 0) && size_sys == sizeof(val) && val)
|
||||
lpmemex->ullTotalPhys = val;
|
||||
mib[1] = HW_USERMEM;
|
||||
size_sys = sizeof(val);
|
||||
sysctl(mib, 2, &val, &size_sys, NULL, 0);
|
||||
if (!val) val = lpmemex->ullTotalPhys;
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user