Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/nss
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2012-10-26 13:51:05 +0200
committerArthur de Jong <arthur@arthurdejong.org>2012-10-26 13:51:05 +0200
commit299527ad524165bf0442b6abd11c7134e35b6f16 (patch)
treeaa212edb026e317988efd2a90e1b6fe9ddf0168c /nss
parent0f4ae2e4a427762e66f21b82d85f4383951a5a42 (diff)
fix buffer size checking in group by member NSS function on Solaris
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1809 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'nss')
-rw-r--r--nss/group.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/nss/group.c b/nss/group.c
index 9b38274..c38d0a2 100644
--- a/nss/group.c
+++ b/nss/group.c
@@ -73,11 +73,11 @@ static nss_status_t read_gids(
/* only add the group to the list if it is not the specified group */
if (gid!=skipgroup)
{
+#ifdef NSS_FLAVOUR_GLIBC
/* check if we reached the limit */
if ( (limit>0) && (*start>=limit) )
return NSS_STATUS_TRYAGAIN;
/* check if our buffer is large enough */
-#ifdef NSS_FLAVOUR_GLIBC
if ((*start)>=(*size))
{
/* for some reason Glibc expects us to grow the array (completely
@@ -94,6 +94,14 @@ static nss_status_t read_gids(
*size=newsize;
}
#endif /* NSS_FLAVOUR_GLIBC */
+#ifdef NSS_FLAVOUR_SOLARIS
+ /* check if we reached the limit */
+ if ( (limit>0) && (*start>=limit) )
+ {
+ errnop=1; /* this is args->ergange */
+ return NSS_STATUS_NOTFOUND;
+ }
+#endif /* NSS_FLAVOUR_SOLARIS */
/* add gid to list */
(*groupsp)[(*start)++]=gid;
}