diff options
author | Georg Pfuetzenreuter | 2024-10-02 21:40:30 +0200 |
---|---|---|
committer | Georg Pfuetzenreuter | 2024-10-02 21:40:30 +0200 |
commit | d99a0d84bf3f473a5b78cf8b16b72c7ca927fdb0 (patch) | |
tree | ec71a9d8bff6b0559bba44422bba7160fcc277cb /wat | |
parent | a5cc5e031754db83816e59849de6cb75ff92f9ae (diff) | |
download | watbot-d99a0d84bf3f473a5b78cf8b16b72c7ca927fdb0.tar.gz watbot-d99a0d84bf3f473a5b78cf8b16b72c7ca927fdb0.tar.bz2 watbot-d99a0d84bf3f473a5b78cf8b16b72c7ca927fdb0.zip |
Strip formatting codes
To allow for correct parsing of messages containing formatting codes and
to avoid exploitation of unparseable messages, strip all formatting
codes from a message when entering the parsing chain.
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Diffstat (limited to 'wat')
-rw-r--r-- | wat/bot.go | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -6,6 +6,7 @@ import ( "strings" "github.com/go-irc/irc" + "github.com/ergochat/irc-go/ircfmt" ) type WatBot struct { @@ -104,7 +105,7 @@ func (w *WatBot) Msg(m *irc.Message) { } // fieldsfunc allows you to obtain rune separated fields/args - args := strings.FieldsFunc(m.Params[1], func(c rune) bool { return c == ' ' }) + args := strings.FieldsFunc(ircfmt.Strip(m.Params[1]), func(c rune) bool { return c == ' ' }) if len(args) == 0 { return |