HomeFreeBSD

fix integer underflow in getgrnam_r and getpwnam_r

Description

fix integer underflow in getgrnam_r and getpwnam_r

Sometimes nscd(8) will return a 1-byte buffer for a nonexistent entry. This
triggered an integer underflow in grp_unmarshal_func, causing getgrnam_r to
return ERANGE instead of 0.

Fix the user's buffer size check, and add a correct check for a too-small
nscd buffer.

PR: 248932
Event: September 2020 Bugathon
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D26204

Details

Provenance
asomersAuthored on
Reviewer
markj
Differential Revision
D26204: fix integer underflow in getgrnam_r and getpwnam_r
Parents
rS365909: MFC r363361:
Branches
Unknown
Tags
Unknown