fix invalid memory access in base64 functions

Boost expects the input to be a multiple of 3 bytes for the encoding and
a multiple of 4 bytes for the decoding. Otherwise it accesses past the
end of the input array. Therefore we now pad with '\0' and replace the
generated 'A' with '='.
Avoid potential buffer overflow with 'input'.
Fix buffer overflow in sorted_string_map by specifying key length.

This also (in theory) lifts the restriction that the key must be
null-terminated.
This is no longer needed.