From bb2731441b1e976d3f38093e0c7bc67fcbb729fd Mon Sep 17 00:00:00 2001 From: zhengxiaoxiao Date: Thu, 26 Sep 2024 21:41:16 +0800 Subject: [PATCH] fix the random number not in the range [min,max] --- ...ndom-number-not-in-the-range-min-max.patch | 26 +++++++++++++++++++ shadow.spec | 6 ++++- 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 fix-the-random-number-not-in-the-range-min-max.patch diff --git a/fix-the-random-number-not-in-the-range-min-max.patch b/fix-the-random-number-not-in-the-range-min-max.patch new file mode 100644 index 0000000..894fb35 --- /dev/null +++ b/fix-the-random-number-not-in-the-range-min-max.patch @@ -0,0 +1,26 @@ +From 1ac596c5e163ef8aefaaff0c265cf9729c2618e0 Mon Sep 17 00:00:00 2001 +From: zhengxiaoxiao +Date: Thu, 26 Sep 2024 21:38:26 +0800 +Subject: [PATCH] fix the random number not in the range [min,max] + +--- + lib/csrand.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/lib/csrand.c b/lib/csrand.c +index e85eaa8..38a3eae 100644 +--- a/lib/csrand.c ++++ b/lib/csrand.c +@@ -92,6 +92,9 @@ csrand_uniform(unsigned long n) + unsigned long + csrand_interval(unsigned long min, unsigned long max) + { ++ if (min == max) { ++ return min; ++ } + return csrand_uniform(max - min + 1) + min; + } + +-- +2.43.0 + diff --git a/shadow.spec b/shadow.spec index daee21a..1b4e5ed 100644 --- a/shadow.spec +++ b/shadow.spec @@ -1,6 +1,6 @@ Name: shadow Version: 4.14.3 -Release: 2 +Release: 3 Epoch: 2 License: BSD and GPLv2+ Summary: Tools for managing accounts and shadow password files @@ -23,6 +23,7 @@ Patch3: backport-port-fix-OVERRUN-CWE-119.patch Patch4: backport-src-usermod.c-update_group_file-Fix-RESOURCE_LEAK-CW.patch Patch5: backport-src-usermod.c-update_gshadow_file-Fix-RESOURCE_LEAK-.patch Patch6: backport-src-groupmod.c-delete-gr_free_members-grp-to-avoid-d.patch +Patch7: fix-the-random-number-not-in-the-range-min-max.patch BuildRequires: gcc, libselinux-devel, audit-libs-devel, libsemanage-devel BuildRequires: libacl-devel, libattr-devel @@ -192,6 +193,9 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/libsubid.{la,a} %{_mandir}/*/* %changelog +* Thu Sep 26 2024 zhengxiaoxiao - 2:4.14.3-3 +- fix the random number not in the range [min,max] + * Mon Jul 15 2024 wangziliang - 2:4.14.3-2 - backport patches from upstream -- Gitee