From 9e355db5885d9cf5c4d14cfe09ae4b2c0ae6a094 Mon Sep 17 00:00:00 2001 From: Tristan Russell Date: Fri, 17 Jan 2025 21:16:36 -0500 Subject: [PATCH] fix: Fix array access for setting port to inactive --- main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index fc58666..8eb3a11 100644 --- a/main.c +++ b/main.c @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -70,7 +71,7 @@ int assign_workers(int* socket_fd) { memcpy(&port, buffer+1, sizeof(u_int32_t)); port = ntohl(port); printf("[Host] Unassigning port %i\n", port); - ports[11000-port] = false; + ports[abs(11000-port)] = false; shutdown(client_sock, SHUT_RDWR); close(client_sock); }