mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 00:37:23 +01:00
PhysicalMemory: fix incorrect size value for large memory sticks
Fix #1061 (integer overflow)
This commit is contained in:
@@ -100,11 +100,11 @@ const char* ffDetectPhysicalMemory(FFlist* result)
|
||||
if (data->Size != 0xFFFF)
|
||||
{
|
||||
if (data->Size == 0x7FFF)
|
||||
device->size = (data->ExtendedSize & ~(1 << 31)) * 1024 * 1024;
|
||||
device->size = (data->ExtendedSize & ~(1ULL << 31)) * 1024ULL * 1024ULL;
|
||||
else if (data->Size & (1 << 15))
|
||||
{
|
||||
// in kB
|
||||
device->size = (data->Size & ~(1u << 15)) * 1024ULL;
|
||||
device->size = (data->Size & ~(1ULL << 15)) * 1024ULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user