From 4fea71625b4c29c388070aa84f83a6e036a5274f Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 2 Aug 2007 02:08:39 +0000 Subject: [PATCH] Fix off by one in group matching. --- match.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/match.c b/match.c index ea52824af..ded638144 100644 --- a/match.c +++ b/match.c @@ -514,7 +514,7 @@ usergr_matches(group, user, pw) { struct group *grp; char **cur; - int n; + int i; /* make sure we have a valid usergroup, sudo style */ if (*group++ != '%') @@ -536,8 +536,8 @@ usergr_matches(group, user, pw) * supplementary group vector, check it first. */ if (strcmp(user, list_pw ? list_pw->pw_name : user_name) == 0) { - for (n = user_ngroups; n != 0; n--) - if (grp->gr_gid == user_groups[n]) + for (i = 0; i < user_ngroups; i++) + if (grp->gr_gid == user_groups[i]) return(TRUE); } if (grp->gr_mem != NULL) { -- 2.50.1