From 087ae892d056f3699db20764b67d785a6980266f Mon Sep 17 00:00:00 2001 From: Thomas Jager Date: Tue, 31 Mar 2015 15:14:13 +0200 Subject: [PATCH] CTCP Messages must be more then 2 characters long. Avoid panic on malformed CTCP messages. --- irc_callback.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/irc_callback.go b/irc_callback.go index ff688c5..a7576c9 100644 --- a/irc_callback.go +++ b/irc_callback.go @@ -77,7 +77,7 @@ func (irc *Connection) ReplaceCallback(eventcode string, i string, callback func // Execute all callbacks associated with a given event. func (irc *Connection) RunCallbacks(event *Event) { msg := event.Message() - if event.Code == "PRIVMSG" && len(msg) > 0 && msg[0] == '\x01' { + if event.Code == "PRIVMSG" && len(msg) > 2 && msg[0] == '\x01' { event.Code = "CTCP" //Unknown CTCP if i := strings.LastIndex(msg, "\x01"); i > -1 {