mirror of https://github.com/XTLS/Xray-core
Return err when short id is too long (#5276)
parent
b030a94435
commit
a36d36b6e5
|
|
@ -629,6 +629,9 @@ func (c *REALITYConfig) Build() (proto.Message, error) {
|
||||||
config.ShortIds = make([][]byte, len(c.ShortIds))
|
config.ShortIds = make([][]byte, len(c.ShortIds))
|
||||||
for i, s := range c.ShortIds {
|
for i, s := range c.ShortIds {
|
||||||
config.ShortIds[i] = make([]byte, 8)
|
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 {
|
if _, err = hex.Decode(config.ShortIds[i], []byte(s)); err != nil {
|
||||||
return nil, errors.New(`invalid "shortIds[`, i, `]": `, s)
|
return nil, errors.New(`invalid "shortIds[`, i, `]": `, s)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue