3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-10 22:19:31 +01:00

restrict nicknames to proper character set

This commit is contained in:
Jeremy Latt 2014-02-26 13:20:41 -08:00
parent 6f00f89efa
commit 9aeb813cf5
2 changed files with 8 additions and 3 deletions

View File

@ -17,13 +17,13 @@ var (
ErrAlreadyDestroyed = errors.New("already destroyed")
// regexps
ChannelNameExpr = regexp.MustCompile(`^[&!#+][[:word:]]{1,63}$`)
ChannelNameExpr = regexp.MustCompile(`^[&!#+][\pL\pN]{1,63}$`)
NicknameExpr = regexp.MustCompile(
"^[[:alpha:]\\[\\]{}^`][[:word:]\\[\\]{}^`]{1,31}$")
"^[\\pL\\[\\]{}^`][\\pL\\pN\\[\\]{}^`]{1,31}$")
)
const (
SEM_VER = "ergonomadic-1.2.6"
SEM_VER = "ergonomadic-1.2.7"
CRLF = "\r\n"
MAX_REPLY_LEN = 512 - len(CRLF)

View File

@ -407,6 +407,11 @@ func (msg *NickCommand) HandleServer(server *Server) {
return
}
if !IsNickname(msg.nickname) {
client.ErrErroneusNickname(msg.nickname)
return
}
if msg.nickname == client.nick {
return
}