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

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