25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

Accept trailing whitespace in Base64 strings

This commit is contained in:
Holger Weiss 2014-10-25 02:05:02 +02:00
parent 8cf43cf750
commit 2399aba67d

View File

@ -798,7 +798,12 @@ base64_to_term(Base64) ->
-spec decode_base64(binary()) -> binary().
decode_base64(S) ->
decode_base64_bin(S, <<>>).
case catch binary:last(S) of
C when C == $\n; C == $\s ->
decode_base64(binary:part(S, 0, byte_size(S) - 1));
_ ->
decode_base64_bin(S, <<>>)
end.
take_without_spaces(Bin, Count) ->
take_without_spaces(Bin, Count, <<>>).