1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-12-21 09:36:34 -05:00

read entire small payload

This commit is contained in:
v2ray 2016-07-03 22:32:28 +02:00
parent e4acfe7f7e
commit 2c259165ff
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -66,6 +66,13 @@ func (this *AuthChunkReader) Read() (*alloc.Buffer, error) {
this.chunkLength = int(length) - 4
this.validator = NewValidator(serial.BytesToUint32(buffer.Value[2:6]))
buffer.SliceFrom(6)
if buffer.Len() < this.chunkLength && this.chunkLength <= 2048 {
_, err := buffer.FillFrom(this.reader)
if err != nil {
buffer.Release()
return nil, io.ErrUnexpectedEOF
}
}
} else if buffer.Len() < this.chunkLength {
_, err := buffer.FillFrom(this.reader)
if err != nil {