Blame SOURCES/libcgroup-0.41-fix-infinite-loop.patch

1c5b3f
From 62bab9d121d4fb416205f5ac53ad342184ae42b6 Mon Sep 17 00:00:00 2001
1c5b3f
From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com>
1c5b3f
Date: Tue, 8 Dec 2015 16:53:41 +0100
1c5b3f
Subject: [PATCH 2/6] api.c: fix infinite loop
1c5b3f
1c5b3f
If getgrnam or getpwuid functions failed, the program entered
1c5b3f
an infinite loop, because the rule pointer was never advanced.
1c5b3f
This is now fixed by updating the pointer before continuing
1c5b3f
to the next iteration.
1c5b3f
---
1c5b3f
 src/api.c | 8 ++++++--
1c5b3f
 1 file changed, 6 insertions(+), 2 deletions(-)
1c5b3f
1c5b3f
diff --git a/src/api.c b/src/api.c
1c5b3f
index df90a6f..217d6c9 100644
1c5b3f
--- a/src/api.c
1c5b3f
+++ b/src/api.c
1c5b3f
@@ -2664,13 +2664,17 @@ static struct cgroup_rule *cgroup_find_matching_rule_uid_gid(uid_t uid,
1c5b3f
 			/* Get the group data. */
1c5b3f
 			sp = &(rule->username[1]);
1c5b3f
 			grp = getgrnam(sp);
1c5b3f
-			if (!grp)
1c5b3f
+			if (!grp) {
1c5b3f
+				rule = rule->next;
1c5b3f
 				continue;
1c5b3f
+			}
1c5b3f
 
1c5b3f
 			/* Get the data for UID. */
1c5b3f
 			usr = getpwuid(uid);
1c5b3f
-			if (!usr)
1c5b3f
+			if (!usr) {
1c5b3f
+				rule = rule->next;
1c5b3f
 				continue;
1c5b3f
+			}
1c5b3f
 
1c5b3f
 			/* If UID is a member of group, we matched. */
1c5b3f
 			for (i = 0; grp->gr_mem[i]; i++) {
1c5b3f
-- 
1c5b3f
2.17.0
1c5b3f