diff --git a/0001-modify-my_strncat-function.patch b/0001-modify-my_strncat-function.patch new file mode 100644 index 0000000000000000000000000000000000000000..4bfd5db83051bec6040f453304dd60aa27aa3c4b --- /dev/null +++ b/0001-modify-my_strncat-function.patch @@ -0,0 +1,15 @@ +diff --git a/lib/sysfs_utils.c b/lib/sysfs_utils.c +index 46e0849..c0176d1 100644 +--- a/lib/sysfs_utils.c ++++ b/lib/sysfs_utils.c +@@ -375,8 +375,8 @@ 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; + } diff --git a/sysfsutils.spec b/sysfsutils.spec index 2c3f91f46207744653e33440b600d5c0f67e9e1d..1758523f8d3a64c2517e9256932088d0661f55a2 100644 --- a/sysfsutils.spec +++ b/sysfsutils.spec @@ -1,4 +1,4 @@ -%define anolis_release 4 +%define anolis_release 5 %global so_major_version 2 %global so_minor_version 0 @@ -13,6 +13,8 @@ License: GPLv2 Source0: https://github.com/linux-ras/sysfsutils/archive/v%{version}.tar.gz +Patch1: 0001-modify-my_strncat-function.patch + BuildRequires: autoconf BuildRequires: automake BuildRequires: libtool @@ -89,6 +91,15 @@ find %{buildroot} -type f -name "*.la" -delete %changelog +* Tue Sep 10 2024 songliang - 2.1.1-5 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC: + The meaning of the "len" parameter in the my_strncat function is the size limit for copying characters from "from", not the size limit for "to" after copying. + Also, the "#define safestrcat(to, from) my_strncat(to, from, sizeof(to) - strlen(to) - 1)" has already imposed a limit on max based on the size of "to". + Modify the function to prevent truncation of content when too many bytes are passed to the my_strcat function. + * Mon Mar 20 2023 Guyu Wang - 2.1.1-4 - Rename man file from systool.1.gz to systool.1.zst