cisco / go-hpke

Implementation of draft-irtf-cfrg-hpke
BSD 2-Clause "Simplified" License
30 stars 15 forks source link

Don't append to a buffer you don't own #25

Closed bifurcation closed 4 years ago

bifurcation commented 4 years ago

Appending to the enc buffer provided by the caller causes problems when the buffer has extra capacity beyond its len, but the data in that extra capacity is owned by other code. This situation can arise due to in-place decoders, as proposed for the TLS-syntax in https://github.com/cisco/go-tls-syntax/pull/1. (Go does not have a way to shrink a slices capacity, unfortunately.)