Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
-
ghx-label-13
Description
The Base64Encode function in coding-util.h with signature
bool Base64Encode(const char* in, int64_t in_len, int64_t out_max, char* out, int64_t* out_len);
fails if '*out_len', when passed to the function, contains a negative value or a value that does not fit in a 32 bit integer.
Internally we use the
int sasl_encode64(const char *in, unsigned inlen, char *out, unsigned outmax, unsigned *outlen);
function and explicitly cast 'out_len' to 'unsigned*'.
The success of this function shouldn't depend on the value of '*out_len' because it is an output parameter, so we should set '*out_len' to zero before passing it to sasl_encode64().