Set the pw_class field to NULL when scanning the non-master passwd file.

This avoids a null pointer deref in pw_dup(), which assumes that all
pointers are either NULL or valid.
This commit is contained in:
Ian Lepore 2018-07-22 22:34:20 +00:00
parent 75b9becc2c
commit cbc397fd10
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336619

View File

@ -170,7 +170,8 @@ __pw_scan(char *bp, struct passwd *pw, int flags)
if (p[0])
pw->pw_fields |= _PWF_EXPIRE;
pw->pw_expire = atol(p);
}
} else
pw->pw_class = NULL;
if (!(pw->pw_gecos = strsep(&bp, ":"))) /* gecos */
goto fmt;
if (pw->pw_gecos[0])