summaryrefslogtreecommitdiffstats
path: root/usr.sbin/newsyslog
diff options
context:
space:
mode:
authorgad <gad@FreeBSD.org>2003-02-24 02:28:46 +0000
committergad <gad@FreeBSD.org>2003-02-24 02:28:46 +0000
commit6f5632ffc0859abc21b1e7f8f07b45f4f69d0cad (patch)
tree695d112fce783acfa08daa76813e99bac9f71477 /usr.sbin/newsyslog
parent750547befe222cad5c199a3a2b287e2701e3138c (diff)
downloadFreeBSD-src-6f5632ffc0859abc21b1e7f8f07b45f4f69d0cad.zip
FreeBSD-src-6f5632ffc0859abc21b1e7f8f07b45f4f69d0cad.tar.gz
Check the value given for number-of-logs to keep in config-file entries,
and error-out if the value is negative (avoiding an infinite loop). PR: bin/30654 (part of it) MFC after: 3 weeks
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