Open
Description
Version
latest
Description
When calling the Base64_Decode() function in wolfcrypt/src/coding.c to decode a short base64 encoded string, it returns BAD_FUNC_ARG.
input:
- in = "Wr8NAAEAVQAAZr9jOA=="
- inLen= 20
- out = our buffer containing space for 13 bytes, because the decoded length is 13
- outLen = 13
At the start of Base64_Decode(), plainSz is calculated, which I guess is an estimate of the decoded size. Because of rounding, this becomes 19, which is then turned into (19*3+3)/4 which equals 15.
This is of course greater than the outLen (15 > 13), so BAD_FUNC_ARG is returned.
The goal of this decoding is to copy the resulting bytes to a struct with a size of 13. De decoded size has 13 bytes, so I would expect it to work as-is. But because of the function requiring a 15 byte buffer, I am wondering whether I am doing something wrong, or if this is a bug. Please advise.
Metadata
Metadata
Assignees
Labels
No labels