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
--- a/src/api.c
+++ b/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.4.3



------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Libcg-devel mailing list
Libcg-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libcg-devel

Reply via email to