From 11da63cf4e9afbaaeace5d20e84bb1d2e533b122 Mon Sep 17 00:00:00 2001 From: Sergei Zhmylev Date: Sun, 29 Jun 2025 15:23:20 +0300 Subject: [PATCH] Fix mistype in accept(2) error handling Due to a mistype in errno checking, sslh-fork process died repeatedly resulting to a complete denial of service on systems with no built-in process supervisors, like FreeBSD. Signed-off-by: Sergei Zhmylev --- sslh-fork.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sslh-fork.c b/sslh-fork.c index 7f2458f..12bbf37 100644 --- a/sslh-fork.c +++ b/sslh-fork.c @@ -182,9 +182,9 @@ void tcp_listener(struct listen_endpoint* endpoint, int num_endpoints, int activ while (1) { in_socket = accept(endpoint[active_endpoint].socketfd, 0, 0); if (in_socket == -1) { - print_message(msg_system_error, "%s:%d:%s:%d:%s\n", + print_message(msg_system_error, "%s:%d:%s:%d:%s\n", __FILE__, __LINE__, "accept", errno, strerror(errno)); - switch(in_socket) { + switch(errno) { case ENETDOWN: /* accept(2) cites all these errnos as "you should retry" */ case EPROTO: case ENOPROTOOPT: