mirror of
https://github.com/ergochat/ergo.git
synced 2025-05-03 13:17:36 +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
|
PingCoalesceThreshold = time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
utf8BOM = "\xef\xbb\xbf"
|
||||||
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
MaxLineLen = DefaultMaxLineLen
|
MaxLineLen = DefaultMaxLineLen
|
||||||
)
|
)
|
||||||
@ -750,7 +754,11 @@ func (client *Client) run(session *Session) {
|
|||||||
continue
|
continue
|
||||||
} // else: proceed with the truncated line
|
} // else: proceed with the truncated line
|
||||||
} else if err != nil {
|
} 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
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user