Add a missing error check. This fixes a bug that would cause pwd_mkdb to

dump core if invoked with an input file that looks like a password file
but isn't (e.g. /etc/group).

PR:		32378
Submitted by:	Maxim Konovalov <maxim@macomnet.ru>
MFC after:	1 week
This commit is contained in:
Dag-Erling Smørgrav 2001-12-04 12:31:02 +00:00
parent fa083d279a
commit a8adfe18ce

View file

@ -133,7 +133,8 @@ __pw_scan(char *bp, struct passwd *pw, int flags)
pw->pw_gid = id;
if (flags & _PWSCAN_MASTER ) {
pw->pw_class = strsep(&bp, ":"); /* class */
if (!(pw->pw_class = strsep(&bp, ":"))) /* class */
goto fmt;
if(pw->pw_class[0]) pw->pw_fields |= _PWF_CLASS;
if (!(p = strsep(&bp, ":"))) /* change */