1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-09-29 23:36:25 -04:00

fix shadowsocks ota

This commit is contained in:
Darien Raymond 2016-11-19 10:57:00 +01:00
parent 5a32cd8602
commit 26aa48d4f9
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -81,6 +81,11 @@ func (this *ChunkReader) Read() (*alloc.Buffer, error) {
// There is a potential buffer overflow here. Large buffer is 64K bytes,
// while uin16 + 10 will be more than that
length := serial.BytesToUint16(buffer.Value[:2]) + AuthSize
if length > alloc.BufferSize {
// Theoretically the size of a chunk is 64K, but most Shadowsocks implementations used <4K buffer.
buffer.Release()
buffer = alloc.NewLocalBuffer(int(length) + 128)
}
if _, err := io.ReadFull(this.reader, buffer.Value[:length]); err != nil {
buffer.Release()
return nil, err