use in-place decryption when opening packets

This commit is contained in:
Marten Seemann 2018-12-30 12:16:53 +07:00
parent e3d2c81729
commit 413844d0bc

View file

@ -93,11 +93,7 @@ func (u *packetUnpacker) Unpack(hdr *wire.Header, data []byte) (*unpackedPacket,
extHdr.PacketNumber,
)
buf := *getPacketBuffer()
buf = buf[:0]
defer putPacketBuffer(&buf)
decrypted, err := opener.Open(buf, data, pn, extHdr.Raw)
decrypted, err := opener.Open(data[:0], data, pn, extHdr.Raw)
if err != nil {
return nil, err
}