From 5f64a588c8518aada0c2c8fb73f6ee753eef8f98 Mon Sep 17 00:00:00 2001 From: tangjie02 Date: Thu, 4 Jul 2024 13:31:05 +0800 Subject: [PATCH 18/22] fix(systeminfo): fix the graphical and network hardware info no display problem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复由于placehold1数组大小太小导致读取显卡和网络信息错误问题 Signed-off-by: tangjie02 --- plugins/systeminfo/systeminfo-hardware.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/systeminfo/systeminfo-hardware.cpp b/plugins/systeminfo/systeminfo-hardware.cpp index 917afe1..73960f7 100644 --- a/plugins/systeminfo/systeminfo-hardware.cpp +++ b/plugins/systeminfo/systeminfo-hardware.cpp @@ -26,7 +26,7 @@ namespace Kiran #define CPUINFO_FILE "/proc/cpuinfo" #define CPUINFO_KEY_DELIMITER ':' #define CPUINFO_KEY_MODEL "model name" -//龙芯cpuinfo中为大写 +// 龙芯cpuinfo中为大写 #define CPUINFO_KEY_MODEL_LS "Model Name" #define CPUINFO_KEY_PROCESSOR "processor" @@ -340,9 +340,9 @@ KVList SystemInfoHardware::get_pcis_by_major_class_id(PCIMajorClassID major_clas auto lines = StrUtils::split_lines(cmd_output); for (auto& line : lines) { - char placehold1[10]; + char placehold1[50]; unsigned int full_class_id; - if (sscanf(line.c_str(), "%9s %x:", placehold1, &full_class_id) == 2) + if (sscanf(line.c_str(), "%49s %x:", placehold1, &full_class_id) == 2) { if ((full_class_id >> 8) == major_class_id) { -- 2.27.0