summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2001-12-04 12:31:02 +0000
committerdes <des@FreeBSD.org>2001-12-04 12:31:02 +0000
commit48c3a59cf5c2f37b3992c5b8aadacbcd818a1de0 (patch)
tree59dde52cb96f5b0aa200c42e5b23718c1e116de6 /lib
parentd8ebdad9deb83beabbb716e91975d48077abb15d (diff)
downloadFreeBSD-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.c3
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 */
OpenPOWER on IntegriCloud