1
0
Fork 0
forked from External/ergo

Avoiding a crash when getting a short ident is a good thing

This commit is contained in:
Daniel Oaks 2019-02-04 05:02:13 +10:00
parent 151002e232
commit e8309aee79
2 changed files with 9 additions and 2 deletions

View file

@ -176,7 +176,10 @@ func NewClient(server *Server, conn net.Conn, isTLS bool) {
client.Notice(client.t("*** Looking up your username"))
resp, err := ident.Query(clientHost, serverPort, clientPort, IdentTimeoutSeconds)
if err == nil {
ident := resp.Identifier[:config.Limits.IdentLen-1]
ident := resp.Identifier
if config.Limits.IdentLen < len(ident) {
ident = ident[:config.Limits.IdentLen]
}
if isIdent(ident) {
identLower := strings.ToLower(ident) // idents can only be ASCII chars only
client.Notice(client.t("*** Found your username"))