diff --git a/infra/conf/transport_internet.go b/infra/conf/transport_internet.go index 2f3b8009..89dfa645 100644 --- a/infra/conf/transport_internet.go +++ b/infra/conf/transport_internet.go @@ -628,6 +628,9 @@ func (c *REALITYConfig) Build() (proto.Message, error) { } config.ShortIds = make([][]byte, len(c.ShortIds)) for i, s := range c.ShortIds { + if len(s) > 16 { + return nil, errors.New(`too long "shortIds[`, i, `]": `, s) + } config.ShortIds[i] = make([]byte, 8) if _, err = hex.Decode(config.ShortIds[i], []byte(s)); err != nil { return nil, errors.New(`invalid "shortIds[`, i, `]": `, s) @@ -679,6 +682,9 @@ func (c *REALITYConfig) Build() (proto.Message, error) { if len(c.ShortIds) != 0 { return nil, errors.New(`non-empty "shortIds", please use "shortId" instead`) } + if len(c.ShortIds) > 16 { + return nil, errors.New(`too long "shortId": `, c.ShortId) + } config.ShortId = make([]byte, 8) if _, err = hex.Decode(config.ShortId, []byte(c.ShortId)); err != nil { return nil, errors.New(`invalid "shortId": `, c.ShortId)