1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-30 05:56:54 -05:00

delay check of remote address

This commit is contained in:
Darien Raymond 2016-12-13 09:17:39 +01:00
parent 8ced9aeec8
commit 76776ddf99
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 9 additions and 1 deletions

View File

@ -97,7 +97,7 @@ func ReadTCPSession(user *protocol.User, reader io.Reader) (*protocol.RequestHea
}
request.Address = v2net.DomainAddress(string(buffer.BytesFrom(-domainLength)))
default:
return nil, nil, errors.New("Shadowsocks|TCP: Unknown address type: ", addrType)
// Check address validity after OTA verification.
}
err = buffer.AppendSupplier(buf.ReadFullFrom(reader, 2))
@ -120,6 +120,10 @@ func ReadTCPSession(user *protocol.User, reader io.Reader) (*protocol.RequestHea
}
}
if request.Address == nil {
return nil, nil, errors.New("Shadowsocks|TCP: Invalid remote address.")
}
var chunkReader buf.Reader
if request.Option.Has(RequestOptionOneTimeAuth) {
chunkReader = NewChunkReader(reader, NewAuthenticator(ChunkKeyGenerator(iv)))

View File

@ -152,6 +152,10 @@ func (v *ServerSession) DecodeRequestHeader(reader io.Reader) (*protocol.Request
return nil, errors.New("VMess|Server: Invalid auth.")
}
if request.Address == nil {
return nil, errors.New("VMess|Server: Invalid remote address.")
}
return request, nil
}