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
This commit is contained in:
Garance A Drosehn 2003-02-24 02:28:46 +00:00
parent 3714896e81
commit 39d0141328
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=111400

View File

@ -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);