Bug 153 - Newsyslog 1.1 core dump with specific config file
Newsyslog 1.1 core dump with specific config file
Status: NEW
Product: Newsyslog
Classification: Unclassified
Component: Newsyslog
1.1
PC FreeBSD
: normal normal
Assigned To: Todd C. Miller
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-10-08 10:55 MDT by Peter Schennink
Modified: 2004-10-08 14:55 MDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Schennink 2004-10-08 10:55:01 MDT
When running with the following /etc/newsyslog.conf file, newsyslog crashes with
a core dump. It appears it cannot handle empty commands well, despite being
mentioned in the man page as a solution if you don't want newsyslog to send
SIGHUP to syslogd when rotating the log.

in line 265 of newsyslog.c, 2 string compares are done in the "if ..."; but one
of the arguments is NULL if an empty command is used in the config file. As a
quick solution i have added a test for NULL for both strmcp arguments:

                                if ((q->pidfile && pltmp->file &&
                                    strcmp(pltmp->file, q->pidfile) == 0 &&
                                    pltmp->signal == q->signal) ||
                                    (q->runcmd && pltmp->file &&
                                    strcmp(q->runcmd, pltmp->file) == 0))
                                        break;
  
example config file:

/var/log/all.log                        600  7     *    @T00  Z
/var/log/amd.log                        644  7     100  *     Z
/var/log/auth.log                       600  7     100  *     Z
/var/log/console.log                    600  5     100  *     Z
/var/log/cron                           600  3     100  *     Z
/var/log/daily.log                      640  7     *    @T00  Z    ""
/var/log/debug.log                      600  7     100  *     Z
/var/log/kerberos.log                   600  7     100  *     Z
/var/log/lpd-errs                       644  7     100  *     Z
/var/log/maillog                        640  7     *    @T00  Z
/var/log/messages                       644  5     100  *     Z
/var/log/monthly.log                    640  12    *    $M1D0 Z    ""
/var/log/ppp.log        root:network    640  3     100  *     Z
/var/log/security                       600  10    100  *     Z    "echo"
/var/log/sendmail.st                    640  10    *    168   B
/var/log/slip.log       root:network    640  3     100  *     Z
/var/log/weekly.log                     640  5     1    $W6D0 Z    ""
/var/log/wtmp                           644  3     *    @01T05 B
/var/log/xferlog                        600  7     100  *     Z