From 517be788687058cee07643ffdea89bfa9d563462 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 26 May 2021 11:21:37 +0200 Subject: [PATCH] Reject JOIN with invalid channel names This prevents us from storing typo'ed channel names in the DB. --- downstream.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/downstream.go b/downstream.go index 123fb2c..eba0560 100644 --- a/downstream.go +++ b/downstream.go @@ -1435,6 +1435,15 @@ func (dc *downstreamConn) handleMessageRegistered(msg *irc.Message) error { key = keys[i] } + if !uc.isChannel(upstreamName) { + dc.SendMessage(&irc.Message{ + Prefix: dc.srv.prefix(), + Command: irc.ERR_NOSUCHCHANNEL, + Params: []string{name, "Not a channel name"}, + }) + continue + } + params := []string{upstreamName} if key != "" { params = append(params, key)