[prev in list] [next in list] [prev in thread] [next in thread]
List: pkg-shadow-devel
Subject: [Pkg-shadow-devel] [PATCH] libmisc/addgrps.c: ngroups allocator fix
From: Cal Peake <cp () absolutedigital ! net>
Date: 2011-05-05 19:56:03
Message-ID: Pine.LNX.4.64.1105051524300.1803 () lancer ! cnet ! absolutedigital ! net
[Download RAW message or body]
Hi,
The memory allocator loop in function add_groups needs an extra check,
otherwise it'll never actually try to allocate for more than 16 groups.
A compile and run-time tested patch is below.
Notably, this quells the "Warning: add_groups: Invalid argument" message
that Slackware (and presumably other non-PAM Linux) users get when logging
in while also being a member of more than 16 groups.
Thanks and kind regards,
--
Cal Peake
--- ./libmisc/addgrps.c~ 2011-02-13 12:58:11.000000000 -0500
+++ ./libmisc/addgrps.c 2011-05-05 14:53:38.000000000 -0400
@@ -71,7 +71,7 @@
return -1;
}
ngroups = getgroups (i, grouplist);
- if ((-1 == ngroups) || (i > (size_t)ngroups)) {
+ if ((-1 == ngroups && EINVAL != errno) || (i > (size_t)ngroups)) {
break;
}
/* not enough room, so try allocating a larger buffer */
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic