From 638fcd3fe2c1c15d01d58c13e17479fdc0ede532 Mon Sep 17 00:00:00 2001 From: PgSocks Date: Wed, 28 Dec 2022 13:51:43 -0600 Subject: [PATCH] Check for invalid max socket fd before polling --- src/connection.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/connection.c b/src/connection.c index 6e3f1dd..5c5ac31 100644 --- a/src/connection.c +++ b/src/connection.c @@ -59,6 +59,10 @@ connection_new(unsigned int source_port, const char* source_ip, unsigned int des struct Connection* connection_poll_ready(struct Client* client) { + // Return a null connection if no sockets have been opened + if(max_fds < 0) + return NULL; + // Add all the connections' socket file descriptors to a watch list fd_set read_fds; FD_ZERO(&read_fds);