From 78003fdc7d427d6010a357ef1cad5452086126bf Mon Sep 17 00:00:00 2001 From: Juliusz Chroboczek Date: Sat, 25 Apr 2020 19:59:53 +0200 Subject: [PATCH] Disallow usernames with spaces. --- client.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/client.go b/client.go index f5f90c5..9a31da4 100644 --- a/client.go +++ b/client.go @@ -12,6 +12,7 @@ import ( "log" "math" "os" + "strings" "sync" "sync/atomic" "time" @@ -151,6 +152,11 @@ func startClient(conn *websocket.Conn) (err error) { c.writerDone = make(chan struct{}) go clientWriter(conn, c.writeCh, c.writerDone) + if strings.ContainsRune(m.Username, ' ') { + err = userError("don't put spaces in your username") + return + } + g, users, err := addClient(m.Group, c, m.Username, m.Password) if err != nil { return