Download raw body.
newsyslog: fix negative size limit bug
On Tue, Jul 22, 2025 at 10:45:56PM +0200, Jan Klemkow wrote: > Hi, > > If you use a size limit of 2 GByte or more in newsyslog.conf, it went > negaive and does not work as expected. This is caused by using atoi(3) > for parsing the size limit from the config file. Changing this function > to strtoll(3) fix this issue. > > ok? Usually we don't like atoi(3) and replace it with strtonum(3). Could you remove all atoi() and implement strtonum() range checking and error message? bluhm > bye, > Jan > > Index: newsyslog.c > =================================================================== > RCS file: /cvs/src/usr.bin/newsyslog/newsyslog.c,v > diff -u -p -r1.116 newsyslog.c > --- newsyslog.c 8 May 2025 15:30:41 -0000 1.116 > +++ newsyslog.c 22 Jul 2025 20:35:04 -0000 > @@ -563,7 +563,7 @@ nextline: > q = parse = missing_field(sob(++parse), errline, lineno); > *(parse = son(parse)) = '\0'; > if (isdigit((unsigned char)*q)) > - working->size = atoi(q) * 1024; > + working->size = strtoll(q, NULL, 10) * 1024; > else > working->size = -1; >
newsyslog: fix negative size limit bug