diff --git a/lshw-fix-mmc.patch b/lshw-fix-mmc.patch new file mode 100644 index 0000000..9d6c193 --- /dev/null +++ b/lshw-fix-mmc.patch @@ -0,0 +1,53 @@ +From 2524bb3def3009e53a78e600bbea2c4639dc1e99 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Fri, 24 Apr 2020 15:02:44 +0200 +Subject: [PATCH] Fix type used for read to ssize_t. + +Function declaration: +ssize_t read(int fd, void *buf, size_t count); + +With size_t the following expression is always true: +while ((count = read(cpuinfo, buffer, sizeof(buffer))) > 0) + +and bad things happen. +--- + src/core/cpuinfo.cc | 2 +- + src/core/osutils.cc | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/core/cpuinfo.cc b/src/core/cpuinfo.cc +index eceb83a..3dbdd0c 100644 +--- a/src/core/cpuinfo.cc ++++ b/src/core/cpuinfo.cc +@@ -589,7 +589,7 @@ bool scan_cpuinfo(hwNode & n) + if (core) + { + char buffer[1024]; +- size_t count; ++ ssize_t count; + string cpuinfo_str = ""; + string description = "", version = ""; + string plat = platform(); +diff --git a/src/core/osutils.cc b/src/core/osutils.cc +index f023a46..a53ed89 100644 +--- a/src/core/osutils.cc ++++ b/src/core/osutils.cc +@@ -148,7 +148,7 @@ vector < string > &list) + { + char buffer[1024]; + string buffer_str = ""; +- size_t count = 0; ++ ssize_t count = 0; + data_file fd = file_open(file); + + if (file_open_error(fd)) +@@ -174,7 +174,7 @@ const string & def) + if (fd >= 0) + { + char buffer[1024]; +- size_t count = 0; ++ ssize_t count = 0; + + memset(buffer, 0, sizeof(buffer)); + result = ""; + diff --git a/lshw-fix-segfault-in-apfs-volume-code.patch b/lshw-fix-segfault-in-apfs-volume-code.patch new file mode 100644 index 0000000..40d7119 --- /dev/null +++ b/lshw-fix-segfault-in-apfs-volume-code.patch @@ -0,0 +1,29 @@ +From 82df4fa7d3705f2f61282ed5b22074d4e0a6efc4 Mon Sep 17 00:00:00 2001 +From: Harry Mallon +Date: Thu, 23 Apr 2020 21:18:47 +0100 +Subject: [PATCH] volumes: fix segfault in apfs volume code + +--- + src/core/volumes.cc | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/core/volumes.cc b/src/core/volumes.cc +index e703523..6fce2ee 100644 +--- a/src/core/volumes.cc ++++ b/src/core/volumes.cc +@@ -784,12 +784,13 @@ struct apfs_super_block { + + static bool detect_apfs(hwNode & n, source & s) + { +- static char buffer[sizeof(apfs_super_block)]; ++ static char buffer[APFS_STANDARD_BLOCK_SIZE]; + source apfsvolume; + apfs_super_block *sb = (apfs_super_block*)buffer; + unsigned long block_size; + + apfsvolume = s; ++ apfsvolume.blocksize = APFS_STANDARD_BLOCK_SIZE; + + if(readlogicalblocks(apfsvolume, buffer, 0, 1)!=1) + return false; + diff --git a/lshw.spec b/lshw.spec index 30e8cac..1fe71b2 100644 --- a/lshw.spec +++ b/lshw.spec @@ -1,7 +1,7 @@ Summary: Hardware lister Name: lshw Version: B.02.19.2 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 URL: http://ezix.org/project/wiki/HardwareLiSter Source0: http://www.ezix.org/software/files/lshw-%{version}.tar.gz @@ -9,6 +9,8 @@ Source1: https://salsa.debian.org/openstack-team/third-party/lshw/raw/debi Patch1: lshw-B.02.18-scandir.patch Patch3: lshw-B.02.18-revert-json.patch Patch4: lshw-B.02.19.2-cmake.patch +Patch5: https://build.opensuse.org/package/view_file/hardware/lshw/lshw-fix-mmc.patch +Patch6: https://build.opensuse.org/package/view_file/hardware/lshw/lshw-fix-segfault-in-apfs-volume-code.patch BuildRequires: cmake BuildRequires: desktop-file-utils BuildRequires: gcc @@ -42,6 +44,8 @@ format. %patch01 -p1 %patch03 -R -p1 %patch04 -p1 +%patch05 -p1 +%patch06 -p1 %build mkdir build && pushd build @@ -91,6 +95,9 @@ src/lshw -json \ %{_datadir}/polkit-1/actions/org.ezix.lshw.gui.policy %changelog +* Fri Apr 24 2020 Terje Rosten - B.02.19.2-2 +- Add patch from openSUSE to fix rhbz#1822455 + * Tue Mar 24 2020 Terje Rosten - B.02.19.2-1 - B.02.19.2