1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-30 12:04:07 +00:00
freebsd/usr.sbin/newsyslog
David Bright 1f641a35fd Fix several Coverity-detected issues in newsyslog.
- CID 1394815, CID 1305673: Dereference before null check - memory was
  allocated and the allocation checked for NULL with a call to errx()
  if it failed. Code below that was guaranteed that the pointer was
  non-NULL, but there was another check for NULL at the exit of the
  function (after the memory had already been referenced). Eliminate
  the useless NULL check.

- CID 1007452: Resource leak - Storage intended to be allocated and
  returned to the caller was never freed. This was the result of a
  regression in the function signature introduced in r208648 (2010)
  (thanks for that find, @cem!). Fixed by altering the function
  signature and passing the allocated memory to the caller as
  intended. This also fixes PR158794.

- CID 1008620: Logically dead code in newsyslog.c - This was a direct
  result of CID 1007452. Since the memory allocated as described there
  was not returned to the caller, a subsequent check for the memory
  having been allocated was dead code. Returning the memory
  re-animates the code that is the subject of this CID.

- CID 1006131: Unused value - in parsing a configuration file, a
  pointer to the end of the last field was saved, but not used after
  that. Rewrite to use the pointer value. This could have been fixed
  by avoiding the assignment altogether, but this solutions more
  closely follows the pattern used in the preceding code.

PR:		158794
Reported by:	Coverity, Ken-ichi EZURA <k.ezura@gmail.com> (PR158794)
Reviewed by:	cem, markj
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D19105
2019-02-22 15:31:50 +00:00
..
newsyslog.conf.d Put a size limit on the opensm.log and use bzip2(1). 2018-11-08 17:00:05 +00:00
tests Adjust the number of tests after r336913. 2018-08-01 18:41:43 +00:00
extern.h various: general adoption of SPDX licensing ID tags. 2017-11-27 15:37:16 +00:00
Makefile Move all the newsyslog related configs to usr.sbin/newsyslog/ 2018-08-12 13:24:53 +00:00
Makefile.depend DIRDEPS_BUILD: Update dependencies. 2017-10-31 00:07:04 +00:00
newsyslog.8 newsyslog.conf: Restrict included files in default config to [!.]*.conf 2018-11-10 10:46:38 +00:00
newsyslog.c Fix several Coverity-detected issues in newsyslog. 2019-02-22 15:31:50 +00:00
newsyslog.conf newsyslog.conf: Restrict included files in default config to [!.]*.conf 2018-11-10 10:46:38 +00:00
newsyslog.conf.5 newsyslog(8): Reject configurations that specify setuid or executable logs 2018-08-21 23:12:46 +00:00
pathnames.h
ptimes.c Add newsyslog capability to write RFC5424 compliant rotation message. 2017-05-26 16:36:30 +00:00