HomeFreeBSD

nfsuserd: Fix OOB access on membership of too many groups

Description

nfsuserd: Fix OOB access on membership of too many groups

getgrouplist() sets the variable containing the allocated length in
input to the full effective group list length, not the number of slots
that were actually filled in case the passed array is too small to
contain it.

While here, on this condition, improve the error message by outputting
the corresponding user name.

MFC after: 1 hour
Fixes: e6c623c86ab4 ("Add support for the "-manage-gids" option to the nfsuserd daemon.")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit bb339adfb2a26c5bb71cd4275dff80f615534ab6)

Details

Provenance
olceAuthored on Thu, Oct 9, 9:19 AM
Parents
rG25624850a77b: initgroups.3: Clarify that ENOMEM is a possible value for 'errno'
Branches
Unknown
Tags
Unknown