diff options
author | dg <dg@FreeBSD.org> | 1995-01-27 22:30:03 +0000 |
---|---|---|
committer | dg <dg@FreeBSD.org> | 1995-01-27 22:30:03 +0000 |
commit | 7e03208067e5a27da1a6e012f5cc23c134344e90 (patch) | |
tree | 757819eabff148837ef841e53626dd1f4c2d6b19 /usr.sbin/pwd_mkdb/pw_scan.c | |
parent | d8ba1dd95a1b1caec9fe87992d51aeb1daf2a60a (diff) | |
download | FreeBSD-src-7e03208067e5a27da1a6e012f5cc23c134344e90.zip FreeBSD-src-7e03208067e5a27da1a6e012f5cc23c134344e90.tar.gz |
Be sure to properly fail if there are not enough fields. Problem
reported by MARC Giannoni <marc@cmc.eng.comsat.com>, this fix is by me.
Diffstat (limited to 'usr.sbin/pwd_mkdb/pw_scan.c')
-rw-r--r-- | usr.sbin/pwd_mkdb/pw_scan.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/pwd_mkdb/pw_scan.c b/usr.sbin/pwd_mkdb/pw_scan.c index fbefc5b..602006e 100644 --- a/usr.sbin/pwd_mkdb/pw_scan.c +++ b/usr.sbin/pwd_mkdb/pw_scan.c @@ -110,10 +110,12 @@ pw_scan(bp, pw) if(p[0]) pw->pw_fields |= _PWF_EXPIRE; pw->pw_expire = atol(p); - pw->pw_gecos = strsep(&bp, ":"); /* gecos */ + if (!(pw->pw_gecos = strsep(&bp, ":"))) /* gecos */ + goto fmt; if(pw->pw_gecos[0]) pw->pw_fields |= _PWF_GECOS; - pw->pw_dir = strsep(&bp, ":"); /* directory */ + if (!(pw->pw_dir = strsep(&bp, ":"))) /* directory */ + goto fmt; if(pw->pw_dir[0]) pw->pw_fields |= _PWF_DIR; if (!(pw->pw_shell = strsep(&bp, ":"))) /* shell */ |