mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 23:47:07 -05:00
Fix buffer overrun in vmess
This commit is contained in:
parent
7d43952690
commit
c20c44526c
@ -30,11 +30,10 @@ func (this *AuthChunkReader) Read() (*alloc.Buffer, error) {
|
|||||||
if length <= 4 { // Length of authentication bytes.
|
if length <= 4 { // Length of authentication bytes.
|
||||||
return nil, io.EOF
|
return nil, io.EOF
|
||||||
}
|
}
|
||||||
if length > 8*1024 {
|
if length > 8*1024-16 {
|
||||||
buffer.Release()
|
buffer.Release()
|
||||||
buffer = alloc.NewLargeBuffer()
|
buffer = alloc.NewLargeBuffer()
|
||||||
}
|
}
|
||||||
buffer.SliceBack(16)
|
|
||||||
if _, err := io.ReadFull(this.reader, buffer.Value[:length]); err != nil {
|
if _, err := io.ReadFull(this.reader, buffer.Value[:length]); err != nil {
|
||||||
buffer.Release()
|
buffer.Release()
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user