From e5576738cb17ab8e19848ffd3d1b48e90b56a3fb Mon Sep 17 00:00:00 2001 From: avg Date: Thu, 3 May 2018 07:28:49 +0000 Subject: [PATCH] MFC r332559: mountd: fix a crash when getgrouplist reports too many groups Sponsored by: Panzura git-svn-id: svn://svn.freebsd.org/base/stable/10@333198 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- usr.sbin/mountd/mountd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr.sbin/mountd/mountd.c b/usr.sbin/mountd/mountd.c index da793cc5d..121867a27 100644 --- a/usr.sbin/mountd/mountd.c +++ b/usr.sbin/mountd/mountd.c @@ -2955,8 +2955,11 @@ parsecred(char *namelist, struct xucred *cr) } cr->cr_uid = pw->pw_uid; ngroups = XU_NGROUPS + 1; - if (getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups)) + if (getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups)) { syslog(LOG_ERR, "too many groups"); + ngroups = XU_NGROUPS + 1; + } + /* * Compress out duplicate. */ -- 2.42.0