Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion irc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ const (
PingCoalesceThreshold = time.Second
)

const (
utf8BOM = "\xef\xbb\xbf"
)

var (
MaxLineLen = DefaultMaxLineLen
)
Expand Down Expand Up @@ -750,7 +754,11 @@ func (client *Client) run(session *Session) {
continue
} // else: proceed with the truncated line
} else if err != nil {
client.Quit(client.t("Received malformed line"), session)
message := "Received malformed line"
if strings.HasPrefix(line, utf8BOM) {
message = "Received UTF-8 byte-order mark, which is invalid at the start of an IRC protocol message"
}
client.Quit(message, session)
break
}

Expand Down