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
base64_encode_expected_len() (from libb64/cencode.h) returns a number that is too small if it is used to allocate a buffer to subsequently pass to base64_encode_chars().
The reason is that the simple base64_encode_chars() includes a newline every 72 characters or so, and these newlines are not catered for in base64_encode_expected_len().
The result of this is that if you try to encode a binary blob larger than about 60 characters you will write past the end of your malloced space.
The text was updated successfully, but these errors were encountered:
The returned number is now too high. For example, in my test case code the real encoded length will be 823 bytes, but base64_encode_expected_len() returns 846.
I've changed the number 18 to 54 (being CHARS_PER_LINE divided by 4, the multiplied by 3) and then 824 is returned, which is what is expected.
base64_encode_expected_len()
(from libb64/cencode.h) returns a number that is too small if it is used to allocate a buffer to subsequently pass tobase64_encode_chars()
.The reason is that the simple
base64_encode_chars()
includes a newline every 72 characters or so, and these newlines are not catered for inbase64_encode_expected_len()
.The result of this is that if you try to encode a binary blob larger than about 60 characters you will write past the end of your malloced space.
The text was updated successfully, but these errors were encountered: