Skip trailing ignored characters in base64 decoding

This commit is contained in:
Frank Denis 2017-09-19 15:09:29 +02:00
parent 70e5ff5e14
commit c7fe84cfb0

View File

@ -298,6 +298,10 @@ sodium_base642bin(unsigned char * const bin, const size_t bin_maxlen,
}
if (ret != 0) {
bin_pos = (size_t) 0U;
} else if (ignore != NULL) {
while (b64_pos < b64_len && strchr(ignore, b64[b64_pos]) != NULL) {
b64_pos++;
}
}
if (bin_len != NULL) {
*bin_len = bin_pos;