diff --git a/dmidecode.spec b/dmidecode.spec index 9097dcf11fabdf615fb0f307d3460d5bb45e4d49..caac5c5ec8a3cf4963e20a77be255d90539d7f27 100644 --- a/dmidecode.spec +++ b/dmidecode.spec @@ -1,6 +1,6 @@ Name: dmidecode Version: 3.4 -Release: 5 +Release: 6 Epoch: 1 Summary: DMI data report tool @@ -12,6 +12,7 @@ Patch6000: bugfix-compat_uuid.patch Patch6001: dmidecode-Split-table-fetching-from-decoding.patch Patch6002: dmidecode-Write-the-whole-dump-file-at-once.patch Patch6003: dmidecode-Do-not-let-dump-bin-overwrite-an-existing-.patch +Patch6004: dmioem-Fix-segmentation-fault-in-dmi_hp_240_attr.patch BuildRequires: make gcc xz @@ -53,6 +54,9 @@ make %{?_smp_mflags} CFLAGS="%{__global_cflags}" LDFLAGS="%{__global_ldflags}" %{_mandir}/man8/*.8.gz %changelog +* Thu Dec 14 2023 lvgenggeng - 1:3.4-6 +- backport: Fix segmentation fault in dmi_hp_240_attr() + * Thu Dec 14 2023 jiahua.yu - 1:3.4-5 - init support for arch ppc64le diff --git a/dmioem-Fix-segmentation-fault-in-dmi_hp_240_attr.patch b/dmioem-Fix-segmentation-fault-in-dmi_hp_240_attr.patch new file mode 100644 index 0000000000000000000000000000000000000000..47eb02de6a807ad087cf1d66f1d59511fa0bcd07 --- /dev/null +++ b/dmioem-Fix-segmentation-fault-in-dmi_hp_240_attr.patch @@ -0,0 +1,46 @@ +From c3357b532941a8df387618e692e522cc7a43b3e8 Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Fri, 9 Sep 2022 11:46:53 +0200 +Subject: [PATCH 1/1] dmioem: Fix segmentation fault in dmi_hp_240_attr() + +pr_attr() does not accept a NULL format string. glibc can deal with +it, but FreeBSD's libc chokes on it. + +Display the attributes as a list instead. Pack the attribute name and +status into a single formatted string that can be passed to +pr_list_item(). That's arguably a hack, but it's cheap, non-intrusive, +and works nicely in the end. + +Bug reported by Scott Benesh (Microchip). + +Signed-off-by: Jean Delvare +Fixes: a4b31b2bc537 ("dmioem: Present HPE type 240 attributes in a nicer way") +Cc: Jerry Hoemann +--- + dmioem.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/dmioem.c b/dmioem.c +index 0c73771..2c24bfb 100644 +--- a/dmioem.c ++++ b/dmioem.c +@@ -198,13 +198,14 @@ static void dmi_hp_240_attr(u64 defined, u64 set) + }; + unsigned int i; + +- pr_attr("Attributes Defined/Set", NULL); ++ pr_list_start("Attributes Defined/Set", NULL); + for (i = 0; i < ARRAY_SIZE(attributes); i++) + { + if (!(defined.l & (1UL << i))) + continue; +- pr_subattr(attributes[i], "%s", set.l & (1UL << i) ? "Yes" : "No"); ++ pr_list_item("%s: %s", attributes[i], set.l & (1UL << i) ? "Yes" : "No"); + } ++ pr_list_end(); + } + + static void dmi_hp_203_assoc_hndl(const char *fname, u16 num) +-- +2.20.1 +