summaryrefslogtreecommitdiff
path: root/functions.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-09-15 17:19:03 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-09-15 17:19:03 +0100
commit6ba01e9fc9727246f40009824f9d0ea49ba92485 (patch)
treeaf7ac5693dcc4b0fc27c6de29497cb2dc74a7cdf /functions.c
parent5550f2f5aeb8f9f1aa3af8159cffda6e7c6d38a2 (diff)
Don't try to socksend() in sendtoclient() if the client wasn't found in the client array.
Diffstat (limited to 'functions.c')
-rw-r--r--functions.c4
1 files changed, 4 insertions, 0 deletions
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) {