fix an offset issue in OTA

pull/215/head v1.19.2
v2ray 2016-07-13 11:38:14 +02:00
parent d602025908
commit fc69c77369
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
2 changed files with 4 additions and 1 deletions

View File

@ -96,7 +96,7 @@ func (this *ChunkReader) Read() (*alloc.Buffer, error) {
log.Debug("AuthenticationReader: Unexpected auth: ", authBytes)
return nil, transport.ErrCorruptedPacket
}
buffer.Value = payload
buffer.SliceFrom(AuthSize)
return buffer, nil
}

View File

@ -18,4 +18,7 @@ func TestNormalChunkReading(t *testing.T) {
payload, err := reader.Read()
assert.Error(err).IsNil()
assert.Bytes(payload.Value).Equals([]byte{11, 12, 13, 14, 15, 16, 17, 18})
payload.PrependBytes(3, 4)
assert.Bytes(payload.Value).Equals([]byte{3, 4, 11, 12, 13, 14, 15, 16, 17, 18})
}