1
0
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:
v2ray 2016-05-03 14:57:09 +02:00
parent 7d43952690
commit c20c44526c

View File

@ -30,11 +30,10 @@ func (this *AuthChunkReader) Read() (*alloc.Buffer, error) {
if length <= 4 { // Length of authentication bytes.
return nil, io.EOF
}
if length > 8*1024 {
if length > 8*1024-16 {
buffer.Release()
buffer = alloc.NewLargeBuffer()
}
buffer.SliceBack(16)
if _, err := io.ReadFull(this.reader, buffer.Value[:length]); err != nil {
buffer.Release()
return nil, err