diff options
author | Jean Delvare <[email protected]> | 2022-09-09 11:46:53 +0200 |
---|---|---|
committer | Jean Delvare <[email protected]> | 2022-09-09 11:46:53 +0200 |
commit | c3357b532941a8df387618e692e522cc7a43b3e8 (patch) | |
tree | 03fbd43b23ead425e5652157917014464881e548 | |
parent | a1a2258ffbe450e8561ee833787da9321fa734b0 (diff) | |
download | dmidecode-c3357b532941a8df387618e692e522cc7a43b3e8.tar.gz |
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 <[email protected]>
Fixes: a4b31b2bc537 ("dmioem: Present HPE type 240 attributes in a nicer way")
Cc: Jerry Hoemann <[email protected]>
-rw-r--r-- | dmioem.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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) |