From 6333a5e7a43b38926da523641b018b791fe1cad1 Mon Sep 17 00:00:00 2001 From: Ethan-Blesch Date: Wed, 17 Dec 2025 13:28:53 -0600 Subject: [PATCH] Update smallchat-server.c Remove out-of-bounds vulnerability --- smallchat-server.c | 1 + 1 file changed, 1 insertion(+) diff --git a/smallchat-server.c b/smallchat-server.c index 67b1589..e15d38b 100644 --- a/smallchat-server.c +++ b/smallchat-server.c @@ -82,6 +82,7 @@ struct client *createClient(int fd) { c->fd = fd; c->nick = chatMalloc(nicklen+1); memcpy(c->nick,nick,nicklen); + assert(c->fd < MAX_CLIENTS); assert(Chat->clients[c->fd] == NULL); // This should be available. Chat->clients[c->fd] = c; /* We need to update the max client set if needed. */