Bug 153

Summary: Newsyslog 1.1 core dump with specific config file
Product: Newsyslog Reporter: Peter Schennink <peter>
Component: NewsyslogAssignee: Todd C. Miller <Todd.Miller>
Status: NEW ---    
Severity: normal    
Priority: normal    
Version: 1.1   
Hardware: PC   
OS: FreeBSD   

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