-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Labels
Description
TL;DR: https://go.dev/play/p/pllZCYDLQ1G
When decoding a 31 byte array from CBOR into a [32]byte array in Go, the code currently sets the remaining items in Go to zero: https://github.com/fxamacker/cbor/blob/master/decode.go#L2391.
Now, this may be a design choice, but me trying to decode into a [32]byte kind of means I fully expect and want 32 bytes or a decode error. Silently padding with zeroes is IMO a potential security issue in certain systems because multiple different input data decodes to the same output struct.