From 396968ab92342b66a5da6e8852204f201bcc547b Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Sat, 5 Apr 2008 13:35:25 +0000 Subject: properly check the limit (as seen in nis-initgroups.c) git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-ldapd@658 ef36b2f9-881f-0410-afb5-c4e39611909c --- nss/group.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'nss') diff --git a/nss/group.c b/nss/group.c index 3ab875d..d552ccf 100644 --- a/nss/group.c +++ b/nss/group.c @@ -64,8 +64,11 @@ static enum nss_status read_gids( READ_TYPE(fp,gid,gid_t); /* skip members */ SKIP_STRINGLIST(fp); + /* check if we reached the limit */ + if ( (limit>0) && (*size>=limit) ) + return NSS_STATUS_SUCCESS; /* check if entry would fit and we have not returned too many */ - if ( ((*start)>=(*size)) || (num>=limit) ) + if ((*start)>=(*size)) { ERROR_OUT_BUFERROR(fp); } /* add gid to list */ (*groupsp)[(*start)++]=gid; -- cgit v1.2.3