diff options
author | des <des@FreeBSD.org> | 2001-12-04 12:31:02 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2001-12-04 12:31:02 +0000 |
commit | 48c3a59cf5c2f37b3992c5b8aadacbcd818a1de0 (patch) | |
tree | 59dde52cb96f5b0aa200c42e5b23718c1e116de6 /lib | |
parent | d8ebdad9deb83beabbb716e91975d48077abb15d (diff) | |
download | FreeBSD-src-48c3a59cf5c2f37b3992c5b8aadacbcd818a1de0.zip FreeBSD-src-48c3a59cf5c2f37b3992c5b8aadacbcd818a1de0.tar.gz |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/gen/pw_scan.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/gen/pw_scan.c b/lib/libc/gen/pw_scan.c index a2eadba..319c38a 100644 --- a/lib/libc/gen/pw_scan.c +++ b/lib/libc/gen/pw_scan.c @@ -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 */ |