From e07fd9492a718360fb0195ad0601ef3d9b2ff709 Mon Sep 17 00:00:00 2001 From: Shivaram Lingamneni Date: Tue, 13 Jun 2023 15:38:34 -0400 Subject: [PATCH] backport fix for #2039 UTF8 should always be validated for websockets, regardless of the incoming message type. --- irc/ircconn.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/irc/ircconn.go b/irc/ircconn.go index 29efbf8d..18d32b7e 100644 --- a/irc/ircconn.go +++ b/irc/ircconn.go @@ -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