You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
In the example code for this API, the comment applies:
// requires at least (sizeof(encoded) * 3 + 3) / 4 room
Can you please let us know about yourself and your project that is using wolfSSL? Here at wolfSSL we love to know about how people are using our code. Some examples would be:
whether this project is for personal, academic or professional interest
are there any institutions associated with this project?
where you are located?
what are you trying to do? What are your goals?
Any information you can provide would be greatly appreciated.
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:
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.
The text was updated successfully, but these errors were encountered: