summaryrefslogtreecommitdiffstats
path: root/usr.sbin/newsyslog
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/newsyslog')
-rw-r--r--usr.sbin/newsyslog/newsyslog.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/newsyslog/newsyslog.c b/usr.sbin/newsyslog/newsyslog.c
index ab52ed8..1dcbedc 100644
--- a/usr.sbin/newsyslog/newsyslog.c
+++ b/usr.sbin/newsyslog/newsyslog.c
@@ -511,8 +511,8 @@ parse_file(char **files)
errx(1, "malformed line (missing fields):\n%s",
errline);
*parse = '\0';
- if (!sscanf(q, "%d", &working->numlogs))
- errx(1, "error in config file; bad number:\n%s",
+ if (!sscanf(q, "%d", &working->numlogs) || working->numlogs < 0)
+ errx(1, "error in config file; bad value for count of logs to save:\n%s",
errline);
q = parse = missing_field(sob(++parse), errline);
OpenPOWER on IntegriCloud