From b98da7cb52a0b6969ff43c921ea40ce4270e5736 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Wed, 10 Jul 2019 23:02:42 +0100 Subject: Make sure messages aren't too long after combining truncated messages. --- blabouncer.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'blabouncer.c') 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 -- cgit v1.2.3