fix possible overrun

This commit is contained in:
Marc-Philip 2017-06-19 13:02:26 +02:00
parent d449b429e8
commit 01215b8519

View File

@ -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