RustCrypto / formats

Cryptography-related format encoders/decoders: DER, PEM, PKCS, PKIX
243 stars 129 forks source link

base32ct: wrong encoded length leads to broken unpadded base32 strings #1420

Closed dodomorandi closed 4 months ago

dodomorandi commented 4 months ago

The following set of bytes, in hex:

12 34 56 78 9a

Are expected to be encoded as the following base32 unpadded string:

CI2FM6E2

However, the length of the encoded string is currently evaluated to be 9 instead of 8, which results in a trailing \0 byte and a broken base32 representation.

tarcieri commented 4 months ago

Dup of #943?

dodomorandi commented 4 months ago

Seems so, sorry for the duplicate.