diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2001-12-04 12:31:02 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2001-12-04 12:31:02 +0000 |
commit | aee27e6814c5af5d1c6283eea3b22588461e46b5 (patch) | |
tree | 08825198890629edc15d3c45c8231ac9c00a6505 /libc | |
parent | 71c5861547c660d88d240434ddb0f63eb66a391c (diff) | |
download | pw-darwin-aee27e6814c5af5d1c6283eea3b22588461e46b5.tar.gz pw-darwin-aee27e6814c5af5d1c6283eea3b22588461e46b5.tar.zst pw-darwin-aee27e6814c5af5d1c6283eea3b22588461e46b5.zip |
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 'libc')
-rw-r--r-- | libc/gen/pw_scan.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libc/gen/pw_scan.c b/libc/gen/pw_scan.c index a2eadba..319c38a 100644 --- a/libc/gen/pw_scan.c +++ b/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 */ |