diff --git a/SOURCES/0001-ledmon-1.1.0-utils-fix-string2ibpi-function.patch b/SOURCES/0001-ledmon-1.1.0-utils-fix-string2ibpi-function.patch new file mode 100644 index 0000000..a398c8f --- /dev/null +++ b/SOURCES/0001-ledmon-1.1.0-utils-fix-string2ibpi-function.patch @@ -0,0 +1,32 @@ +From 740a352626e2ed5d26389200f38323fde9bd84f1 Mon Sep 17 00:00:00 2001 +From: Blazej Kucman +Date: Wed, 16 Apr 2025 12:26:38 +0200 +Subject: [PATCH] utils: Fix string2ibpi function + +string2ibpi does not compare strings correctly, the function uses strncmp, +which in case strings of different lengths, may return incorrect value +if substrings of given max length are identical. In this function whole +strings must be identical. + +Fix is to change strncmp to strcmp. + +Fixes intel/ledmon#259 +Fixes: 94818457f615 ("Add struct for mapping ibpi statuses to strings. (#211)") +Signed-off-by: Blazej Kucman +--- + src/lib/utils.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/lib/utils.c b/src/lib/utils.c +index bad35eb4..2fe0f764 100644 +--- a/src/lib/utils.c ++++ b/src/lib/utils.c +@@ -765,7 +765,7 @@ enum led_ibpi_pattern string2ibpi(const char *name) + if (!input_name) + continue; + +- if (strncmp(input_name, name, strlen(input_name)) == 0) ++ if (strcmp(input_name, name) == 0) + return ipbi_names[i].ibpi; + } + diff --git a/SPECS/ledmon.spec b/SPECS/ledmon.spec index 1c6f198..95e2c48 100644 --- a/SPECS/ledmon.spec +++ b/SPECS/ledmon.spec @@ -1,11 +1,13 @@ Summary: Enclosure LED Utilities Name: ledmon Version: 1.1.0 -Release: 1%{?dist} +Release: 3%{?dist} License: GPLv2+ URL: https://github.com/intel/ledmon Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz +Patch: 0001-ledmon-1.1.0-utils-fix-string2ibpi-function.patch + BuildRequires: autoconf automake BuildRequires: autoconf-archive BuildRequires: gcc make @@ -50,7 +52,7 @@ The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %prep -%setup -q +%autosetup -p1 autoreconf -fiv %build @@ -88,6 +90,12 @@ find %{buildroot} -name '*.la' -delete %{_libdir}/pkgconfig/%{name}.pc %changelog +* Wed Jul 23 2025 Jan Macku - 1.1.0-3 +- Bump release (RHEL-95751) + +* Mon Jun 09 2025 Jan Macku - 1.1.0-2 +- Fix string2ibpi function (RHEL-95751) + * Tue Nov 12 2024 Jan Macku - 1.1.0-1 - update to 1.1.0