mirror of
https://github.com/jeremyd/ergo.git
synced 2026-05-12 19:58:36 -07:00
Avoiding a crash when getting a short ident is a good thing
This commit is contained in:
@@ -2193,7 +2193,11 @@ func userHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
||||
return false
|
||||
}
|
||||
|
||||
ident := msg.Params[0][:server.Limits().IdentLen-1] // -1 as SetNames adds the ~ at the start for us
|
||||
ident := msg.Params[0]
|
||||
identLen := server.Limits().IdentLen
|
||||
if identLen-1 < len(ident) {
|
||||
ident = ident[:server.Limits().IdentLen-1] // -1 as SetNames adds the ~ at the start for us
|
||||
}
|
||||
|
||||
err := client.SetNames(ident, msg.Params[3])
|
||||
if err == errInvalidUsername {
|
||||
|
||||
Reference in New Issue
Block a user