libcgroup: add upstream patch that fixes infinite loop in cgrulesengd (#5133)
The patch comes from: https://sourceforge.net/p/libcg/libcg/ci/master/tree/ SHA1-id: 1bce3ab63968022e97599bbd73ec1a66aacf45bc Minor manual tweak added to avoid setting patch_args
This commit is contained in:
parent
96603e9fde
commit
30ccfb7672
2 changed files with 39 additions and 1 deletions
38
srcpkgs/libcgroup/patches/api.c-fix-infinite-loop.patch
Normal file
38
srcpkgs/libcgroup/patches/api.c-fix-infinite-loop.patch
Normal file
|
@ -0,0 +1,38 @@
|
|||
Date: Tue, 8 Dec 2015 16:53:41 +0100
|
||||
Subject: [PATCH] api.c: fix infinite loop
|
||||
|
||||
If getgrnam or getpwuid functions failed, the program entered
|
||||
an infinite loop, because the rule pointer was never advanced.
|
||||
This is now fixed by updating the pointer before continuing
|
||||
to the next iteration.
|
||||
---
|
||||
src/api.c | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/src/api.c b/src/api.c
|
||||
index d6c9d3a..ef796ac 100644
|
||||
--- src/api.c
|
||||
+++ src/api.c
|
||||
@@ -2775,13 +2775,17 @@ static struct cgroup_rule *cgroup_find_matching_rule_uid_gid(uid_t uid,
|
||||
/* Get the group data. */
|
||||
sp = &(rule->username[1]);
|
||||
grp = getgrnam(sp);
|
||||
- if (!grp)
|
||||
+ if (!grp) {
|
||||
+ rule = rule->next;
|
||||
continue;
|
||||
+ }
|
||||
|
||||
/* Get the data for UID. */
|
||||
usr = getpwuid(uid);
|
||||
- if (!usr)
|
||||
+ if (!usr) {
|
||||
+ rule = rule->next;
|
||||
continue;
|
||||
+ }
|
||||
|
||||
/* If UID is a member of group, we matched. */
|
||||
for (i = 0; grp->gr_mem[i]; i++) {
|
||||
--
|
||||
2.10.2
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
# Template file for 'libcgroup'
|
||||
pkgname=libcgroup
|
||||
version=0.41
|
||||
revision=5
|
||||
revision=6
|
||||
build_style=gnu-configure
|
||||
configure_args="--sbindir=/usr/bin --enable-pam-module-dir=/usr/lib/security"
|
||||
hostmakedepends="flex automake libtool"
|
||||
|
|
Loading…
Reference in a new issue