mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-25 14:46:04 +03:00
Avoid panic in BytesTo func
This commit is contained in:
parent
ceff4185dc
commit
c880b916ee
@ -110,6 +110,9 @@ func (b *Buffer) BytesTo(to int32) []byte {
|
|||||||
if to < 0 {
|
if to < 0 {
|
||||||
to += b.Len()
|
to += b.Len()
|
||||||
}
|
}
|
||||||
|
if to < 0 {
|
||||||
|
to = 0
|
||||||
|
}
|
||||||
return b.v[b.start : b.start+to]
|
return b.v[b.start : b.start+to]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user