Merge pull request #1438 from slingamn/issue1436_badchars

fix #1436
This commit is contained in:
Shivaram Lingamneni 2020-12-22 02:16:01 -05:00 committed by GitHub
commit a566c85b12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -117,6 +117,10 @@ func (clients *ClientManager) SetNick(client *Client, session *Session, newNick
realname := client.realname realname := client.realname
client.stateMutex.RUnlock() client.stateMutex.RUnlock()
if newNick != accountName && strings.ContainsAny(newNick, disfavoredNameCharacters) {
return "", errNicknameInvalid, false
}
// recompute always-on status, because client.alwaysOn is not set for unregistered clients // recompute always-on status, because client.alwaysOn is not set for unregistered clients
var alwaysOn, useAccountName bool var alwaysOn, useAccountName bool
if account != "" { if account != "" {

View File

@ -31,6 +31,11 @@ const (
// @ separates username from hostname // @ separates username from hostname
// : means trailing // : means trailing
protocolBreakingNameCharacters = " ,*?.!@:" protocolBreakingNameCharacters = " ,*?.!@:"
// #1436: we discovered that these characters are problematic,
// so we're disallowing them in new nicks/account names, but allowing
// previously registered names
disfavoredNameCharacters = `<>'";`
) )
var ( var (