cloudflare / circl

CIRCL: Cloudflare Interoperable Reusable Cryptographic Library
http://blog.cloudflare.com/introducing-circl
Other
1.3k stars 144 forks source link

hpke: Enforces passing a slice of exact size to UnmarshalBinary for KEM keys #489

Open armfazh opened 7 months ago

armfazh commented 7 months ago

hpke: Allows passing a larger buffer to UnmarshalBinary for KEM keys. It checks data passed is in the right boundaries. Also adds a test showing the issue.

Fixes #488

bwesterb commented 7 months ago

Why should we accept a buffer that is too large? Wouldn't we miss certain bugs if we do?

armfazh commented 6 months ago

Agree, I have changed the code, so now, it enforces passing a slice of the exact size when unmarshaling keys. Otherwise, it returns an error instead of panic, which is the actual bug reported in #488 .