Browse Source

Fix buffer overrun in vmess

v2ray 9 years ago
parent
commit
c20c44526c
1 changed files with 1 additions and 2 deletions
  1. 1 2
      proxy/vmess/io/reader.go

+ 1 - 2
proxy/vmess/io/reader.go

@@ -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