summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-07-10 23:02:42 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-07-10 23:02:42 +0100
commitb98da7cb52a0b6969ff43c921ea40ce4270e5736 (patch)
treefc155666fced93001178db356f5b11fc31008949
parent726496b1711117d113b8da971edf8114db07ab06 (diff)
Make sure messages aren't too long after combining truncated messages.
-rw-r--r--blabouncer.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/blabouncer.c b/blabouncer.c
index 8f5afad..ddcd07f 100644
--- a/blabouncer.c
+++ b/blabouncer.c
@@ -301,6 +301,11 @@ int processrawstring(SSL *server_ssl, char *str, int source, struct client *clie
debugprint(DEBUG_FULL, "...into new string '%s' and clearing currentmsg holding area.\n", messages[0]);
ircdstate->currentmsg[0] = '\0';
free(strtmp);
+ // Make sure the resulting message isn't too long
+ if (strlen(messages[0]) >= MAXDATASIZE - 1) {
+ debugprint(DEBUG_CRIT, "processrawstring(): combined truncated message '%d' is too long (%ld out of a maximum of %d characters), clearing it.\n", messages[0], strlen(messages[0]), MAXDATASIZE - 1);
+ messages[0][0] = '\0';
+ }
}
// If the final characters of the raw string weren't \r\n then assume the final token is a truncated message