diff --git a/0001-dmidecode-Fix-the-condition-error-in-ascii_filter.patch b/0001-dmidecode-Fix-the-condition-error-in-ascii_filter.patch new file mode 100644 index 0000000000000000000000000000000000000000..c493c26f6660181b619fc28b3c451f7a60bb0876 --- /dev/null +++ b/0001-dmidecode-Fix-the-condition-error-in-ascii_filter.patch @@ -0,0 +1,30 @@ +From 1117390ccd9cea139638db6f460bb6de70e28f94 Mon Sep 17 00:00:00 2001 +From: Tianjia Zhang +Date: Tue, 5 Jan 2021 10:36:29 +0100 +Subject: [PATCH] dmidecode: Fix the condition error in ascii_filter + +The normal printable ASCII range is 32 to 127 (not included), +so fix the error in this if condition. + +Signed-off-by: Tianjia Zhang +Signed-off-by: Jean Delvare +--- + dmidecode.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dmidecode.c b/dmidecode.c +index 27d5494..864a193 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -116,7 +116,7 @@ static void ascii_filter(char *bp, size_t len) + size_t i; + + for (i = 0; i < len; i++) +- if (bp[i] < 32 || bp[i] == 127) ++ if (bp[i] < 32 || bp[i] >= 127) + bp[i] = '.'; + } + +-- +2.32.0 + diff --git a/0002-dmidecode-Fix-crash-with-u-option.patch b/0002-dmidecode-Fix-crash-with-u-option.patch new file mode 100644 index 0000000000000000000000000000000000000000..fac875227e053a8446da959eb950b54d36f76346 --- /dev/null +++ b/0002-dmidecode-Fix-crash-with-u-option.patch @@ -0,0 +1,34 @@ +From 11e134e54d15e67a64c39a623f492a28df922517 Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Tue, 19 Jan 2021 16:26:01 +0100 +Subject: [PATCH] dmidecode: Fix crash with -u option + +A segmentation fault was reported with option -u. Turns out to be a +stupid thinko where the buffer offset was reset at the wrong loop +depth. + +Reported-by: Jerry Hoemann +Fixes: da06888d08b9 ("dmidecode: Use the print helpers in dump mode too") +Signed-off-by: Jean Delvare +--- + dmidecode.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dmidecode.c b/dmidecode.c +index 572cb1a..69ea0e8 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -248,9 +248,9 @@ static void dmi_dump(const struct dmi_header *h) + { + int j, l = strlen(s) + 1; + +- off = 0; + for (row = 0; row < ((l - 1) >> 4) + 1; row++) + { ++ off = 0; + for (j = 0; j < 16 && j < l - (row << 4); j++) + off += sprintf(raw_data + off, + j ? " %02X" : "%02X", +-- +2.32.0 + diff --git a/dmidecode-3.3.tar.xz b/dmidecode-3.3.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..7e680abe8d652630b9e82e4718b9efef39b8b376 Binary files /dev/null and b/dmidecode-3.3.tar.xz differ diff --git a/dmidecode.spec b/dmidecode.spec new file mode 100644 index 0000000000000000000000000000000000000000..07c9aaeddcc36ec9d8042037b6852702269368c8 --- /dev/null +++ b/dmidecode.spec @@ -0,0 +1,52 @@ +%define anolis_release 1 + +Name: dmidecode +Version: 3.3 +Release: %{anolis_release}%{?dist} +Summary: Tool to analyse BIOS DMI data + +License: GPLv2+ +URL: https://www.nongnu.org/dmidecode/ +Source0: https://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz + +Patch0001: 0001-dmidecode-Fix-the-condition-error-in-ascii_filter.patch +Patch0002: 0002-dmidecode-Fix-crash-with-u-option.patch + +BuildRequires: gcc +BuildRequires: make +ExclusiveArch: x86_64 aarch64 + +%description +dmidecode reports information about x86 & ia64 hardware as described in the +system BIOS according to the SMBIOS/DMI standard. This information +typically includes system manufacturer, model name, serial number, +BIOS version, asset tag as well as a lot of other details of varying +level of interest and reliability depending on the manufacturer. + +This will often include usage status for the CPU sockets, expansion +slots (e.g. AGP, PCI, ISA) and memory module slots, and the list of +I/O ports (e.g. serial, parallel, USB). + +%prep +%autosetup -p1 + +%build +make %{?_smp_mflags} CFLAGS="%{optflags}" LDFLAGS="%{__global_ldflags}" + +%install +make install DESTDIR=%{buildroot} prefix=%{_prefix} install-bin install-man + +%files +%doc AUTHORS NEWS README +%license LICENSE +%{_sbindir}/dmidecode +%ifarch x86_64 +%{_sbindir}/vpddecode +%{_sbindir}/ownership +%{_sbindir}/biosdecode +%endif +%{_mandir}/man8/* + +%changelog +* Tue Mar 01 2022 Su Lifan - 3.3-1 +- Initial packaging for Anolis 23