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
atchops_base64_encode requires a pre-allocated buffer, which is an anti-pattern for returning null-terminated strings. We can coerce our own null-terminated string by allocating one byte longer than we pass as the buffer size into this function. The style for this function should change to not require input or output parameters, and the function should determine and allocate the buffer itself.
The text was updated successfully, but these errors were encountered:
We have a function called atchops_base64_encoded_size which provides the size required for a buffer to be encoded in base64. If you pass that size in to atchops_base64_encode you will get a buffer which is not null-terminated, but if you pass a size which is larger than that by at least one byte, then you will get a null-terminated buffer.
atchops_base64_encode requires a pre-allocated buffer, which is an anti-pattern for returning null-terminated strings. We can coerce our own null-terminated string by allocating one byte longer than we pass as the buffer size into this function. The style for this function should change to not require input or output parameters, and the function should determine and allocate the buffer itself.
The text was updated successfully, but these errors were encountered: