From aee27e6814c5af5d1c6283eea3b22588461e46b5 Mon Sep 17 00:00:00 2001 From: Dag-Erling Smørgrav Date: Tue, 4 Dec 2001 12:31:02 +0000 Subject: 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 MFC after: 1 week --- libc/gen/pw_scan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'libc') 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 */ -- cgit v1.2.3-56-ge451