fix possible overrun
This commit is contained in:
parent
d449b429e8
commit
01215b8519
@ -1209,7 +1209,12 @@ wxMemorySize wxGetFreeMemory()
|
||||
{
|
||||
unsigned long cached;
|
||||
if ( sscanf(buf, "Cached: %lu", &cached) == 1 )
|
||||
memFree += cached;
|
||||
{
|
||||
if ( cached > ULONG_MAX-memFree )
|
||||
memFree = ULONG_MAX;
|
||||
else
|
||||
memFree += cached;
|
||||
}
|
||||
}
|
||||
|
||||
// values here are always expressed in kB and we want bytes
|
||||
|
Loading…
Reference in New Issue
Block a user