VLESS Encryption: Check 17~17000 -> Check 17~16640 (#5698)

https://github.com/XTLS/Xray-core/pull/5698#issuecomment-3938558695
This commit is contained in:
Miny
2026-03-03 12:08:02 +00:00
committed by GitHub
parent 7dada1da2b
commit 9514e988d8

View File

@@ -107,7 +107,7 @@ func (c *CommonConn) Read(b []byte) (int, error) {
if _, err := io.ReadFull(c.Conn, peerHeader[:]); err != nil {
return 0, err
}
l, err := DecodeHeader(peerHeader[:]) // l: 17~17000
l, err := DecodeHeader(peerHeader[:]) // l: 17~16640
if err != nil {
if c.Client != nil && strings.Contains(err.Error(), "invalid header: ") { // client's 0-RTT
c.Client.RWLock.Lock()
@@ -214,7 +214,7 @@ func DecodeHeader(h []byte) (l int, err error) {
if h[0] != 23 || h[1] != 3 || h[2] != 3 {
l = 0
}
if l < 17 || l > 17000 { // TODO: TLSv1.3 max length
if l < 17 || l > 16640 { // TLS 1.3 max record: 16384 + 256 (RFC 8446 §5.2)
err = errors.New("invalid header: " + fmt.Sprintf("%v", h[:5])) // DO NOT CHANGE: relied by client's Read()
}
return