From 1fd9cd5e2797dec4ed4881c431eb4253fef6b79826ed0ce157d60e26417ec046 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 22 Jan 2021 15:04:31 +0000 Subject: [PATCH] 2 recommended fixes from upstream: - dmidecode-fix-the-condition-error-in-ascii_filter.patch: dmidecode: Fix the condition error in ascii_filter. - dmidecode-fix-crash-with-u-option.patch: dmidecode: Fix crash with -u option. OBS-URL: https://build.opensuse.org/package/show/Base:System/dmidecode?expand=0&rev=60 --- dmidecode-fix-crash-with-u-option.patch | 30 +++++++++++++++++++ ...-the-condition-error-in-ascii_filter.patch | 26 ++++++++++++++++ dmidecode.changes | 9 ++++++ dmidecode.spec | 6 +++- 4 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 dmidecode-fix-crash-with-u-option.patch create mode 100644 dmidecode-fix-the-condition-error-in-ascii_filter.patch diff --git a/dmidecode-fix-crash-with-u-option.patch b/dmidecode-fix-crash-with-u-option.patch new file mode 100644 index 0000000..efb96b4 --- /dev/null +++ b/dmidecode-fix-crash-with-u-option.patch @@ -0,0 +1,30 @@ +From: Jean Delvare +Date: Tue, 19 Jan 2021 16:26:01 +0100 +Subject: dmidecode: Fix crash with -u option +Git-commit: 11e134e54d15e67a64c39a623f492a28df922517 +Patch-mainline: yes + +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(-) + +--- dmidecode-3.3.orig/dmidecode.c 2021-01-22 15:51:26.330074180 +0100 ++++ dmidecode-3.3/dmidecode.c 2021-01-22 15:51:29.445143171 +0100 +@@ -248,9 +248,9 @@ static void dmi_dump(const struct dmi_he + { + 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", diff --git a/dmidecode-fix-the-condition-error-in-ascii_filter.patch b/dmidecode-fix-the-condition-error-in-ascii_filter.patch new file mode 100644 index 0000000..e0ae595 --- /dev/null +++ b/dmidecode-fix-the-condition-error-in-ascii_filter.patch @@ -0,0 +1,26 @@ +From: Tianjia Zhang +Date: Tue, 5 Jan 2021 10:36:29 +0100 +Subject: dmidecode: Fix the condition error in ascii_filter +Git-commit: 1117390ccd9cea139638db6f460bb6de70e28f94 +Patch-mainline: yes + +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(-) + +--- dmidecode-3.3.orig/dmidecode.c 2020-10-14 14:51:11.000000000 +0200 ++++ dmidecode-3.3/dmidecode.c 2021-01-22 15:51:26.330074180 +0100 +@@ -116,7 +116,7 @@ static void ascii_filter(char *bp, size_ + 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] = '.'; + } + diff --git a/dmidecode.changes b/dmidecode.changes index 47d69ba..5d46db9 100644 --- a/dmidecode.changes +++ b/dmidecode.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Fri Jan 22 14:58:16 UTC 2021 - Jean Delvare + +2 recommended fixes from upstream: +- dmidecode-fix-the-condition-error-in-ascii_filter.patch: + dmidecode: Fix the condition error in ascii_filter. +- dmidecode-fix-crash-with-u-option.patch: dmidecode: Fix crash + with -u option. + ------------------------------------------------------------------- Wed Oct 14 15:53:32 UTC 2020 - Jean Delvare diff --git a/dmidecode.spec b/dmidecode.spec index 7a888bb..bef2389 100644 --- a/dmidecode.spec +++ b/dmidecode.spec @@ -1,7 +1,7 @@ # # spec file for package dmidecode # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -27,6 +27,8 @@ Source0: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{vers Source1: http://download.savannah.gnu.org/releases/%{name}/%{name}-%{version}.tar.xz.sig # https://savannah.nongnu.org/project/memberlist-gpgkeys.php?group=dmidecode Source2: %{name}.keyring +Patch1: dmidecode-fix-the-condition-error-in-ascii_filter.patch +Patch2: dmidecode-fix-crash-with-u-option.patch Provides: pmtools:%{_sbindir}/dmidecode Obsoletes: pmtools < 20071117 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -49,6 +51,8 @@ the BIOS told it to. %prep %setup -q +%patch1 -p1 +%patch2 -p1 %build CFLAGS="%{optflags}" make %{?_smp_mflags}