fix possible overrun
This commit is contained in:
@@ -1209,7 +1209,12 @@ wxMemorySize wxGetFreeMemory()
|
|||||||
{
|
{
|
||||||
unsigned long cached;
|
unsigned long cached;
|
||||||
if ( sscanf(buf, "Cached: %lu", &cached) == 1 )
|
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
|
// values here are always expressed in kB and we want bytes
|
||||||
|
Reference in New Issue
Block a user