From 4c8b01fb5180a8c308ce0d823b1acf912f6d8b0e Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 6 Jul 2020 10:59:34 +0200 Subject: [PATCH] Make length check clearer in sendNames --- bridge.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bridge.go b/bridge.go index d21dfe1..e434c49 100644 --- a/bridge.go +++ b/bridge.go @@ -48,7 +48,8 @@ func sendNames(dc *downstreamConn, ch *upstreamChannel) { for nick, memberships := range ch.Members { s := memberships.Format(dc) + dc.marshalEntity(ch.conn.network, nick) - if buf.Len() != 0 && maxLength < buf.Len()+1+len(s) { + n := buf.Len() + 1 + len(s) + if buf.Len() != 0 && n > maxLength { // There's not enough space for the next space + nick. dc.SendMessage(&irc.Message{ Prefix: dc.srv.prefix(),