An early check in b64encode() (base64.c:256) appears as follows:
if (*s == '\0') return calloc(1, sizeof(*t));
I'm finding that this line is causing b64encode() to fail to process data (in my case, SHA-1 digests) that happen to begin with "0x00". The input data should not be assumed to be a character string, so IMO, this check end-of-string check should be omitted.
Thanks for reporting - this is a known problem and has been fixed in the CVS.
Thanks, Bob. Another issue (which seems also to be present in the version checked into CVS), this time regarding the end of the data that I pass into b64encode(): When I pass in a SHA-1 digest (exactly 20 bytes), the penultimate Base-64-encoded character (i.e. prior to the last "=") is wrong. I found that if I padded the end of my data with an extra byte set to "0x0", the correct Base-64 encoding comes out. Is the function making an assumption that the data is null-terminated? Thanks again.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.