freebsd-src/usr.sbin/newsyslog
Garance A Drosehn ca927128bf When parsing a rule to rotate log files on a specific week day,
parseDWM() can advance the time to the next week. If the next week is
in the next month, then tm_mon is incremented. However, the increment
was failing to handle the wraparound from December to January, so when
parsing a rule during the last week of the December, the month would
advance to month 12. This triggered an out-of-bounds read of the
mtab[] array in days_pmonth() after parseDWM() returned.  To fix,
this change resets the month to January and increment the year when
the month increment wraps.

The default rule for /var/log/weekly.log triggers this during the
last week of December each year.
Reported by:	CHERI
Obtained from:	CheriBSD
Reviewed by:	jhb
Sponsored by:	The University of Cambridge, Google Inc.
Differential Revision:	<https://reviews.freebsd.org/D33687>

(cherry picked from commit b7b447fd4c)
2023-09-23 21:04:40 +00:00
..
newsyslog.conf.d Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
tests Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
extern.h Remove $FreeBSD$: one-line .h pattern 2023-08-23 11:43:22 -06:00
Makefile Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
Makefile.depend Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
newsyslog.8 Remove $FreeBSD$: one-line nroff pattern 2023-08-23 11:43:32 -06:00
newsyslog.c Remove $FreeBSD$: one-line .c pattern 2023-08-23 11:43:26 -06:00
newsyslog.conf Remove $FreeBSD$: one-line sh pattern 2023-08-23 11:43:30 -06:00
newsyslog.conf.5 Remove $FreeBSD$: one-line nroff pattern 2023-08-23 11:43:32 -06:00
pathnames.h Remove $FreeBSD$: one-line bare tag 2023-08-23 11:43:33 -06:00
ptimes.c When parsing a rule to rotate log files on a specific week day, 2023-09-23 21:04:40 +00:00