Fix segfault when info about block storage is absent

i9-old changed/i9/hardinfo-0.6-1.20230524git45fa969.el9.inferit.7
Alexey Berezhok 1 year ago
parent 128efbdff8
commit 795cd4d967

@ -0,0 +1,34 @@
From 8e2247a195b5d31595ef12a5b007dde46b2ada94 Mon Sep 17 00:00:00 2001
From: Alexey Berezhok <aberezhok@msvsphere-os.ru>
Date: Fri, 13 Oct 2023 20:06:34 +0300
Subject: [PATCH] Fix segfault when info about block storage is absent
---
hardinfo/storage_util.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hardinfo/storage_util.c b/hardinfo/storage_util.c
index ce82407..7e61d33 100644
--- a/hardinfo/storage_util.c
+++ b/hardinfo/storage_util.c
@@ -100,7 +100,7 @@ void check_sdcard_vendor(u2driveext *e) {
g_file_get_contents(oemid_path, &oemid, NULL, NULL);
g_file_get_contents(manfid_path, &manfid, NULL, NULL);
- unsigned int id = strtol(oemid, NULL, 16);
+ unsigned int id = oemid?strtol(oemid, NULL, 16):0;
char c2 = id & 0xff, c1 = (id >> 8) & 0xff;
qpath = g_strdup_printf("OEMID %02x%02x", (unsigned int)c1, (unsigned int)c2);
@@ -114,7 +114,7 @@ void check_sdcard_vendor(u2driveext *e) {
isprint(c1) ? c1 : '.', isprint(c2) ? c2 : '.');
g_free(qpath);
- id = strtol(manfid, NULL, 16);
+ id = manfid?strtol(manfid, NULL, 16):0;
qpath = g_strdup_printf("MANFID %06x", id);
scan_ids_file(sdcard_ids_file, qpath, &result, -1);
g_free(manfid);
--
2.39.1

@ -3,7 +3,7 @@
Name: hardinfo Name: hardinfo
Version: 0.6 Version: 0.6
Release: 1.20230524git%{shorthash}%{?dist}.inferit.6 Release: 1.20230524git%{shorthash}%{?dist}.inferit.7
Summary: System Profiler and Benchmark Summary: System Profiler and Benchmark
License: GPLv2 License: GPLv2
@ -14,6 +14,7 @@ Source2: hardinfo-root.desktop
Source3: org.freedesktop.pkexec.hardinfo.policy Source3: org.freedesktop.pkexec.hardinfo.policy
Patch1: 0001-Remove-annoyng-window-about-loading-of-needed-librar.patch Patch1: 0001-Remove-annoyng-window-about-loading-of-needed-librar.patch
Patch2: 0002-vendor.ids-Added-MSVSphere-OS.patch Patch2: 0002-vendor.ids-Added-MSVSphere-OS.patch
Patch3: 0003-Fix-segfault-when-info-about-block-storage-is-absent.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: desktop-file-utils BuildRequires: desktop-file-utils
@ -77,6 +78,9 @@ install -m644 %{SOURCE3} \
%{_datadir}/polkit-1/actions/org.freedesktop.pkexec.hardinfo.policy %{_datadir}/polkit-1/actions/org.freedesktop.pkexec.hardinfo.policy
%changelog %changelog
* Fri Oct 13 2023 Alexey Berezhok <aberezhok@msvsphere-os.ru> - 0.6-2.20230524git45fa969.inferit.7
- Fix segfault when info about block storage is absent
* Wed Sep 27 2023 Arkady L. Shane <tigro@msvsphere-os.ru> - 0.6-2.20230524git45fa969.inferit.6 * Wed Sep 27 2023 Arkady L. Shane <tigro@msvsphere-os.ru> - 0.6-2.20230524git45fa969.inferit.6
- Leave only superuser desktop file - Leave only superuser desktop file

Loading…
Cancel
Save