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
This commit is contained in:
Jean Delvare 2021-01-22 15:04:31 +00:00 committed by Git OBS Bridge
parent 56735f9d8b
commit 1fd9cd5e27
4 changed files with 70 additions and 1 deletions

View File

@ -0,0 +1,30 @@
From: Jean Delvare <jdelvare@suse.de>
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 <jerry.hoemann@hpe.com>
Fixes: da06888d08b9 ("dmidecode: Use the print helpers in dump mode too")
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
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",

View File

@ -0,0 +1,26 @@
From: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
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 <tianjia.zhang@linux.alibaba.com>
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
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] = '.';
}

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Jan 22 14:58:16 UTC 2021 - Jean Delvare <jdelvare@suse.de>
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 <jdelvare@suse.de>

View File

@ -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}