From a36d36b6e5f676afa82f45a64413982b43cf650b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E6=89=87=E6=BB=91=E7=BF=94=E7=BF=BC?= Date: Sat, 15 Nov 2025 10:00:32 +0800 Subject: [PATCH] Return err when short id is too long (#5276) --- infra/conf/transport_internet.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/infra/conf/transport_internet.go b/infra/conf/transport_internet.go index 2f3b8009..dd756083 100644 --- a/infra/conf/transport_internet.go +++ b/infra/conf/transport_internet.go @@ -629,6 +629,9 @@ func (c *REALITYConfig) Build() (proto.Message, error) { config.ShortIds = make([][]byte, len(c.ShortIds)) for i, s := range c.ShortIds { config.ShortIds[i] = make([]byte, 8) + if len(s) > 16 { + return nil, errors.New(`invalid "shortIds[`, i, `]": `, s) + } if _, err = hex.Decode(config.ShortIds[i], []byte(s)); err != nil { return nil, errors.New(`invalid "shortIds[`, i, `]": `, s) }