Hi,

When syslogd is sending via TCP, there a file descriptor leak and
a use after free if it receives a SIGHUP.  Call bufferevent_free()
to deactivate the callbacks and close the TCP socket.

ok?

bluhm

Index: usr.sbin/syslogd/syslogd.c
===================================================================
RCS file: /data/mirror/openbsd/cvs/src/usr.sbin/syslogd/syslogd.c,v
retrieving revision 1.137
diff -u -p -r1.137 syslogd.c
--- usr.sbin/syslogd/syslogd.c  31 Dec 2014 13:55:57 -0000      1.137
+++ usr.sbin/syslogd/syslogd.c  1 Jan 2015 19:00:15 -0000
@@ -1342,7 +1342,11 @@ init(void)
                        (void)close(f->f_file);
                        break;
                case F_FORWUDP:
-               case F_FORWTCP:  /* XXX close and reconnect? */
+                       break;
+               case F_FORWTCP:
+                       /* XXX save messages in output buffer for reconnect */
+                       bufferevent_free(f->f_un.f_forw.f_bufev);
+                       close(f->f_un.f_forw.f_fd);
                        break;
                }
                next = f->f_next;

Reply via email to