Prevent use after free of TLS context at syslogd(8) shutdown.
authorbluhm <bluhm@openbsd.org>
Sat, 6 Jan 2024 19:34:54 +0000 (19:34 +0000)
committerbluhm <bluhm@openbsd.org>
Sat, 6 Jan 2024 19:34:54 +0000 (19:34 +0000)
commit172a5cb9e97bbdbd24138e1da075cab9f863e85b
tree9e7b7e352e83a2087ba1cf88b05fb701fe588fb5
parent899d618dd8aca2fe45326d82a8cd7cfc967d151f
Prevent use after free of TLS context at syslogd(8) shutdown.

When splitting the event fields f_ev and f_bufev, disabling some
events was missed.  Callbacks could happen after tls_free().  Call
bufferevent_disable() before f_bufev and struct filed are cleaned.
In some error cases f_bufev might be NULL, add a check before
cleanup.

OK tb@
usr.sbin/syslogd/syslogd.c