1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

util/base64: add a note about zero length strings

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Douglas Bagnall 2022-05-13 10:59:24 +12:00 committed by Andrew Bartlett
parent c3ded9d934
commit 5c007600dc

View File

@ -115,8 +115,16 @@ _PUBLIC_ char *base64_encode_data_blob(TALLOC_CTX *mem_ctx, DATA_BLOB data)
size_t out_cnt, len, output_len;
char *result;
if (!data.length || !data.data)
/*
* Note: we return NULL for a zero-length blob, even though it can be
* encoded as a zero length string in base64.
*
* FIXME, perhaps, but we need to check carefully before changing
* this.
*/
if (data.length == 0 || data.data == NULL) {
return NULL;
}
out_cnt = 0;
len = data.length;