!92 [sync] PR-91: 【Mainline】Backport patch from upstream to avoid unsigned integer underflow
From: @openeuler-sync-bot Reviewed-by: @HuaxinLuGitee Signed-off-by: @HuaxinLuGitee
This commit is contained in:
commit
5c6c2213c4
52
backport-setfiles-avoid-unsigned-integer-underflow.patch
Normal file
52
backport-setfiles-avoid-unsigned-integer-underflow.patch
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
From fc2e9318d0a1b2ec331f6af25e70358f130d003b Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
|
||||||
|
Date: Tue, 19 Dec 2023 17:09:33 +0100
|
||||||
|
Subject: [PATCH] setfiles: avoid unsigned integer underflow
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
While well-defined unsigned integer underflow might signal a logic
|
||||||
|
mistake or processing of unchecked user input. Please Clang's undefined
|
||||||
|
behavior sanitizer:
|
||||||
|
|
||||||
|
restore.c:91:37: runtime error: unsigned integer overflow: 1 - 2 cannot be represented in type 'unsigned long'
|
||||||
|
|
||||||
|
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
|
||||||
|
Acked-by: James Carter <jwcart2@gmail.com>
|
||||||
|
---
|
||||||
|
policycoreutils/setfiles/restore.c | 10 +++++-----
|
||||||
|
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/policycoreutils/setfiles/restore.c b/policycoreutils/setfiles/restore.c
|
||||||
|
index 6131f46a..d045e948 100644
|
||||||
|
--- a/policycoreutils/setfiles/restore.c
|
||||||
|
+++ b/policycoreutils/setfiles/restore.c
|
||||||
|
@@ -77,8 +77,8 @@ int process_glob(char *name, struct restore_opts *opts, size_t nthreads,
|
||||||
|
long unsigned *skipped_errors)
|
||||||
|
{
|
||||||
|
glob_t globbuf;
|
||||||
|
- size_t i = 0;
|
||||||
|
- int len, rc, errors;
|
||||||
|
+ size_t i, len;
|
||||||
|
+ int rc, errors;
|
||||||
|
|
||||||
|
memset(&globbuf, 0, sizeof(globbuf));
|
||||||
|
|
||||||
|
@@ -88,10 +88,10 @@ int process_glob(char *name, struct restore_opts *opts, size_t nthreads,
|
||||||
|
return errors;
|
||||||
|
|
||||||
|
for (i = 0; i < globbuf.gl_pathc; i++) {
|
||||||
|
- len = strlen(globbuf.gl_pathv[i]) - 2;
|
||||||
|
- if (len > 0 && strcmp(&globbuf.gl_pathv[i][len--], "/.") == 0)
|
||||||
|
+ len = strlen(globbuf.gl_pathv[i]);
|
||||||
|
+ if (len > 2 && strcmp(&globbuf.gl_pathv[i][len - 2], "/.") == 0)
|
||||||
|
continue;
|
||||||
|
- if (len > 0 && strcmp(&globbuf.gl_pathv[i][len], "/..") == 0)
|
||||||
|
+ if (len > 3 && strcmp(&globbuf.gl_pathv[i][len - 3], "/..") == 0)
|
||||||
|
continue;
|
||||||
|
rc = selinux_restorecon_parallel(globbuf.gl_pathv[i],
|
||||||
|
opts->restorecon_flags,
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
Name: policycoreutils
|
Name: policycoreutils
|
||||||
Version: 3.5
|
Version: 3.5
|
||||||
Release: 1
|
Release: 2
|
||||||
Summary: Policy core utilities of selinux
|
Summary: Policy core utilities of selinux
|
||||||
License: GPLv2
|
License: GPLv2
|
||||||
URL: https://github.com/SELinuxProject
|
URL: https://github.com/SELinuxProject
|
||||||
@ -16,6 +16,7 @@ Source11: selinux-autorelabel-generator.sh
|
|||||||
|
|
||||||
Patch0: fix-fixfiles-N-date-function.patch
|
Patch0: fix-fixfiles-N-date-function.patch
|
||||||
Patch1: fix-fixfiles-N-date-function-two.patch
|
Patch1: fix-fixfiles-N-date-function-two.patch
|
||||||
|
Patch2: backport-setfiles-avoid-unsigned-integer-underflow.patch
|
||||||
|
|
||||||
BuildRequires: gcc
|
BuildRequires: gcc
|
||||||
BuildRequires: pam-devel libsepol-static >= %{version} libsemanage-static >= %{version} libselinux-devel >= %{version} libcap-devel audit-libs-devel gettext
|
BuildRequires: pam-devel libsepol-static >= %{version} libsemanage-static >= %{version} libselinux-devel >= %{version} libcap-devel audit-libs-devel gettext
|
||||||
@ -257,6 +258,9 @@ find %{buildroot}%{python3_sitelib} %{buildroot}%{python3_sitearch} \
|
|||||||
%{_mandir}/*
|
%{_mandir}/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Mar 20 2024 yixiangzhike <yixiangzhike007@163.com> - 3.5-2
|
||||||
|
- backport patch from upstream to avoid unsigned integer underflow
|
||||||
|
|
||||||
* Mon Jul 17 2023 zhangguangzhi <zhangguangzhi3@huawei.com> - 3.5-1
|
* Mon Jul 17 2023 zhangguangzhi <zhangguangzhi3@huawei.com> - 3.5-1
|
||||||
- update version to 3.5
|
- update version to 3.5
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user