From 2f3861e7328f08ba299cd45f4922142d341487a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sun, 22 Dec 2024 20:27:27 +0800 Subject: [PATCH] PhysicalMemory: clean up garbage data --- src/detection/physicalmemory/physicalmemory.c | 1 + src/detection/physicalmemory/physicalmemory_linux.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/detection/physicalmemory/physicalmemory.c b/src/detection/physicalmemory/physicalmemory.c index c5df181f3..70e111b08 100644 --- a/src/detection/physicalmemory/physicalmemory.c +++ b/src/detection/physicalmemory/physicalmemory.c @@ -23,6 +23,7 @@ static inline const char* getVendorString(unsigned vendorId) void FFPhysicalMemoryUpdateVendorString(FFPhysicalMemoryResult* device) { + if (device->vendor.length == 0) return; if (ffStrbufEqualS(&device->vendor, "Unknown")) { ffStrbufClear(&device->vendor); diff --git a/src/detection/physicalmemory/physicalmemory_linux.c b/src/detection/physicalmemory/physicalmemory_linux.c index fc83f92a3..cfc18fe30 100644 --- a/src/detection/physicalmemory/physicalmemory_linux.c +++ b/src/detection/physicalmemory/physicalmemory_linux.c @@ -191,6 +191,7 @@ const char* ffDetectPhysicalMemory(FFlist* result) device->maxSpeed = data->Speed == 0xFFFF ? data->ExtendedSpeed : data->Speed; ffStrbufSetStatic(&device->vendor, ffSmbiosLocateString(strings, data->Manufacturer)); + ffCleanUpSmbiosValue(&device->vendor); FFPhysicalMemoryUpdateVendorString(device); ffStrbufSetStatic(&device->serial, ffSmbiosLocateString(strings, data->SerialNumber));