mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-05 00:47:51 -05:00
make sure dc id is valid.
This commit is contained in:
parent
d7def8bf47
commit
b16d2e9463
@ -22,7 +22,7 @@ type Authentication struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (a *Authentication) DataCenterID() uint16 {
|
func (a *Authentication) DataCenterID() uint16 {
|
||||||
return (uint16(a.Header[61]) << 8) | uint16(a.Header[60])
|
return ((uint16(a.Header[61]) << 8) | uint16(a.Header[60])) % uint16(len(dcList))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Authentication) ApplySecret(b []byte) {
|
func (a *Authentication) ApplySecret(b []byte) {
|
||||||
|
@ -90,9 +90,6 @@ func (s *Server) Process(ctx context.Context, network net.Network, conn internet
|
|||||||
}
|
}
|
||||||
|
|
||||||
dcID := auth.DataCenterID()
|
dcID := auth.DataCenterID()
|
||||||
if dcID >= uint16(len(dcList)) {
|
|
||||||
return newError("invalid data center id: ", dcID)
|
|
||||||
}
|
|
||||||
|
|
||||||
dest := net.Destination{
|
dest := net.Destination{
|
||||||
Network: net.Network_TCP,
|
Network: net.Network_TCP,
|
||||||
|
Loading…
Reference in New Issue
Block a user