From 2e1261bc215f63c7b3980543911a49fce5083f53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 30 Jun 2024 19:04:44 +0800 Subject: [PATCH] PhysicalMemory: fix incorrect size value for large memory sticks Fix #1061 (integer overflow) --- src/detection/physicalmemory/physicalmemory_linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/detection/physicalmemory/physicalmemory_linux.c b/src/detection/physicalmemory/physicalmemory_linux.c index a773d3d93..a1f0de70d 100644 --- a/src/detection/physicalmemory/physicalmemory_linux.c +++ b/src/detection/physicalmemory/physicalmemory_linux.c @@ -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 {