From 0b333c7e7294ee8fdcca78f38944a06ac271591c Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Mon, 10 Jun 2024 23:20:22 -0400 Subject: [PATCH 1/2] fix truncation check * The message target was not being counted :-( * The additional character added to the target by STATUSMSG was not counted --- irc/channel.go | 10 +++++----- irc/handlers.go | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/irc/channel.go b/irc/channel.go index 4d0216b7..664ea14d 100644 --- a/irc/channel.go +++ b/irc/channel.go @@ -1320,6 +1320,11 @@ func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mod isBot := client.HasMode(modes.Bot) chname := channel.Name() + // STATUSMSG targets are prefixed with the supplied min-prefix, e.g., @#channel + if minPrefixMode != modes.Mode(0) { + chname = fmt.Sprintf("%s%s", modes.ChannelModePrefixes[minPrefixMode], chname) + } + if !client.server.Config().Server.Compatibility.allowTruncation { if !validateSplitMessageLen(histType, details.nickMask, chname, message) { rb.Add(nil, client.server.name, ERR_INPUTTOOLONG, details.nick, client.t("Line too long to be relayed without truncation")) @@ -1327,11 +1332,6 @@ func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mod } } - // STATUSMSG targets are prefixed with the supplied min-prefix, e.g., @#channel - if minPrefixMode != modes.Mode(0) { - chname = fmt.Sprintf("%s%s", modes.ChannelModePrefixes[minPrefixMode], chname) - } - if channel.flags.HasMode(modes.OpModerated) { channel.stateMutex.RLock() cuData, ok := channel.members[client] diff --git a/irc/handlers.go b/irc/handlers.go index c8c85fd2..0f264a87 100644 --- a/irc/handlers.go +++ b/irc/handlers.go @@ -2184,6 +2184,7 @@ func validateLineLen(msgType history.ItemType, source, target, payload string) ( default: return true } + limit -= len(target) limit -= len(payload) return limit >= 0 } From 2bb0a9c8e3ddb52eb2bf4469bdcc8e5fe726506e Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Tue, 11 Jun 2024 17:06:58 -0400 Subject: [PATCH 2/2] bump irctest to fork's master --- irctest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irctest b/irctest index af980ed3..9856317a 160000 --- a/irctest +++ b/irctest @@ -1 +1 @@ -Subproject commit af980ed3b639b5e1b3749c74027872adb69922a7 +Subproject commit 9856317a64e0b72f925bd1a77cbce7e0f460eb59