Fix erroneous my_strncat implementation

Resolves: RHEL-83777
This commit is contained in:
Vitezslav Crhonek 2025-04-22 09:37:37 +02:00
parent 62ac53981e
commit 737c294bd9
2 changed files with 28 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,15 @@
Name: sysfsutils
Version: 2.1.1
Release: 10%{?dist}
Release: 11%{?dist}
Summary: Utilities for interfacing with sysfs
URL: https://github.com/linux-ras/sysfsutils
License: GPLv2
Source0: https://github.com/linux-ras/sysfsutils/archive/v%{version}.tar.gz
Patch0: sysfsutils-2.1.1-fix-my-strncat.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
@ -71,6 +73,10 @@ find %{buildroot} -type f -name "*.la" -delete
%changelog
* Tue Apr 22 2025 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.1.1-11
- Fix erroneous my_strncat implementation
Resolves: RHEL-83777
* Wed Jan 26 2022 Chris White <chwhite@redhat.com> - 2.1.1-10
- Rebuilding for RHEL9. Resolves rhbz#2043148