From 6ba01e9fc9727246f40009824f9d0ea49ba92485 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Sun, 15 Sep 2019 17:19:03 +0100 Subject: Don't try to socksend() in sendtoclient() if the client wasn't found in the client array. --- functions.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/functions.c b/functions.c index 3dd8045..a8f0927 100644 --- a/functions.c +++ b/functions.c @@ -425,6 +425,10 @@ int sendtoclient(int fd, char *strsrc, struct client *clients, struct settings * break; } } + if (i == MAXCLIENTS ) { + debugprint(DEBUG_CRIT, "error: sendtoclient() client fd %d not found in clients array, returning 0.\n", fd); + return 0; + } debugprint(DEBUG_SOME, "sendtoclient(): sending \"%s\" (length %zd) to client with fd %d.\n", str, strlen(str), fd); if (socksend(clients[i].ssl, str, strlen(str), settings->clienttls) == -1) { -- cgit v1.2.3