summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/pwd_mkdb/pwd_mkdb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.sbin/pwd_mkdb/pwd_mkdb.c b/usr.sbin/pwd_mkdb/pwd_mkdb.c
index 3c8ca25..2abbcdf 100644
--- a/usr.sbin/pwd_mkdb/pwd_mkdb.c
+++ b/usr.sbin/pwd_mkdb/pwd_mkdb.c
@@ -204,7 +204,11 @@ main(int argc, char *argv[])
/* check only if password database is valid */
if (Cflag) {
- for (cnt = 1; scan(fp, &pwd); ++cnt);
+ while (scan(fp, &pwd))
+ if (!is_comment && strlen(pwd.pw_name) >= MAXLOGNAME) {
+ warnx("%s: username too long", pwd.pw_name);
+ exit(1);
+ }
exit(0);
}
OpenPOWER on IntegriCloud