3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-27 22:39:25 +01:00

backport fix for #2039

UTF8 should always be validated for websockets, regardless of the incoming
message type.
This commit is contained in:
Shivaram Lingamneni 2023-06-13 15:38:34 -04:00
parent b14095f7ba
commit e07fd9492a

View File

@ -128,9 +128,9 @@ func (wc IRCWSConn) WriteLines(buffers [][]byte) (err error) {
}
func (wc IRCWSConn) ReadLine() (line []byte, err error) {
messageType, line, err := wc.conn.ReadMessage()
_, line, err = wc.conn.ReadMessage()
if err == nil {
if messageType == websocket.BinaryMessage && !utf8.Valid(line) {
if !utf8.Valid(line) {
return line, errInvalidUtf8
}
return line, nil