summaryrefslogtreecommitdiffstats
path: root/pw/pw_conf.c
diff options
context:
space:
mode:
Diffstat (limited to 'pw/pw_conf.c')
-rw-r--r--pw/pw_conf.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/pw/pw_conf.c b/pw/pw_conf.c
index c6a86b7..c1b5b33 100644
--- a/pw/pw_conf.c
+++ b/pw/pw_conf.c
@@ -355,12 +355,20 @@ read_userconfig(char const * file)
}
break;
case _UC_EXPIRE:
- if ((q = unquote(q)) != NULL && isdigit(*q))
- config.expire_days = atoi(q);
+ if ((q = unquote(q)) != NULL) {
+ errstr = NULL;
+ config.expire_days = strtonum(q, 0, INT_MAX, &errstr);
+ if (errstr)
+ warnx("Invalid expire days: '%s', ignoring", q);
+ }
break;
case _UC_PASSWORD:
- if ((q = unquote(q)) != NULL && isdigit(*q))
- config.password_days = atoi(q);
+ if ((q = unquote(q)) != NULL) {
+ errstr = NULL;
+ config.password_days = strtonum(q, 0, INT_MAX, &errstr);
+ if (errstr)
+ warnx("Invalid password days: '%s', ignoring", q);
+ }
break;
case _UC_FIELDS:
case _UC_NONE: