Fix erroneous my_strncat implementation

Resolves: RHEL-83778
This commit is contained in:
Vitezslav Crhonek 2025-04-22 09:46:09 +02:00
parent 5a2623c061
commit 1ea97b9845
2 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,21 @@
diff -up sysfsutils-2.1.1/lib/sysfs_utils.c.orig sysfsutils-2.1.1/lib/sysfs_utils.c
--- sysfsutils-2.1.1/lib/sysfs_utils.c.orig 2025-03-11 15:06:31.976403632 +0100
+++ sysfsutils-2.1.1/lib/sysfs_utils.c 2025-03-13 08:40:42.648753678 +0100
@@ -369,14 +369,14 @@ char *my_strncpy(char *to, const char *f
}
/**
- * my_strncpy -- a safe strncpy
+ * my_strncat -- a safe strncat
*/
char *my_strncat(char *to, const char *from, size_t max)
{
size_t i = 0;
- while (i < max && to[i] != '\0')
+ while (to[i] != '\0')
i++;
- my_strncpy(to+i, from, max-i);
+ my_strncpy(to+i, from, max);
return to;
}

View File

@ -4,13 +4,14 @@
Name: sysfsutils
Version: 2.1.1
Release: 14%{?dist}
Release: 15%{?dist}
Summary: Utilities for interfacing with sysfs
URL: https://github.com/linux-ras/sysfsutils
License: GPL-2.0-only
Source0: https://github.com/linux-ras/sysfsutils/archive/v%{version}.tar.gz
Patch0: sysfsutils-2.1.1-fix-memleaks-of-by-one-error.patch
Patch1: sysfsutils-2.1.1-fix-my-strncat.patch
BuildRequires: autoconf
BuildRequires: automake
@ -73,6 +74,10 @@ find %{buildroot} -type f -name "*.la" -delete
%changelog
* Tue Apr 22 2025 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.1.1-15
- Fix erroneous my_strncat implementation
Resolves: RHEL-83778
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 2.1.1-14
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018