mirror of
https://github.com/ergochat/ergo.git
synced 2025-04-22 07:47:56 +02:00
Fix #2244 Produce an explicit error on receiving the UTF-8 BOM
This commit is contained in:
parent
68cee9e2cd
commit
5bab190d33
@ -71,6 +71,10 @@ const (
|
||||
PingCoalesceThreshold = time.Second
|
||||
)
|
||||
|
||||
const (
|
||||
utf8BOM = "\xef\xbb\xbf"
|
||||
)
|
||||
|
||||
var (
|
||||
MaxLineLen = DefaultMaxLineLen
|
||||
)
|
||||
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user