From d8d8b04e93be758d96d9cf8d8ffa3f063adf51fc Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Thu, 2 Apr 2020 16:36:04 -0400 Subject: Do not crash on error from accept --- bounce.c | 5 +++++ local.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bounce.c b/bounce.c index 604830a..6c3e285 100644 --- a/bounce.c +++ b/bounce.c @@ -484,6 +484,11 @@ int main(int argc, char *argv[]) { if (!event.clients[i]) { int fd; struct tls *tls = localAccept(&fd, event.fds[i].fd); + if (!tls) { + warn("accept"); + continue; + } + int error = tls_handshake(tls); if (error) { warnx("tls_handshake: %s", tls_error(tls)); diff --git a/local.c b/local.c index a4de1bc..0a140e6 100644 --- a/local.c +++ b/local.c @@ -205,7 +205,7 @@ static int recvfd(int sock) { struct tls *localAccept(int *fd, int bind) { *fd = accept(bind, NULL, NULL); - if (*fd < 0) err(EX_IOERR, "accept"); + if (*fd < 0) return NULL; if (unix) { int sent = recvfd(*fd); -- cgit 1.4.1