diff options
author | Björn Gustavsson <[email protected]> | 2015-11-30 13:54:10 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-11-30 13:54:10 +0100 |
commit | b185ad94ac37e20c57d24fb0da4b46d923af53eb (patch) | |
tree | ebedb827618a017aad6b55d5e66470ad0d1a5ca9 /lib/asn1/src | |
parent | 53bfaec70f9f6daaae079a1c5cd852f4df214b57 (diff) | |
download | otp-b185ad94ac37e20c57d24fb0da4b46d923af53eb.tar.gz otp-b185ad94ac37e20c57d24fb0da4b46d923af53eb.tar.bz2 otp-b185ad94ac37e20c57d24fb0da4b46d923af53eb.zip |
BER: Fix encoding of empty named BIT STRING
Encoding an empty named BIT STRING would fail for BER.
Noticed-by: Svilen Ivanov
Diffstat (limited to 'lib/asn1/src')
-rw-r--r-- | lib/asn1/src/asn1rtt_ber.erl | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/asn1/src/asn1rtt_ber.erl b/lib/asn1/src/asn1rtt_ber.erl index 39fa8aaf99..e50b14941c 100644 --- a/lib/asn1/src/asn1rtt_ber.erl +++ b/lib/asn1/src/asn1rtt_ber.erl @@ -739,6 +739,8 @@ encode_named_bit_string([H|_]=Bits, NamedBitList, TagIn) when is_atom(H) -> do_encode_named_bit_string(Bits, NamedBitList, TagIn); encode_named_bit_string([{bit,_}|_]=Bits, NamedBitList, TagIn) -> do_encode_named_bit_string(Bits, NamedBitList, TagIn); +encode_named_bit_string([], _NamedBitList, TagIn) -> + encode_unnamed_bit_string(<<>>, TagIn); encode_named_bit_string(Bits, _NamedBitList, TagIn) when is_bitstring(Bits) -> encode_unnamed_bit_string(Bits, TagIn). @@ -746,6 +748,8 @@ encode_named_bit_string(C, [H|_]=Bits, NamedBitList, TagIn) when is_atom(H) -> do_encode_named_bit_string(C, Bits, NamedBitList, TagIn); encode_named_bit_string(C, [{bit,_}|_]=Bits, NamedBitList, TagIn) -> do_encode_named_bit_string(C, Bits, NamedBitList, TagIn); +encode_named_bit_string(C, [], _NamedBitList, TagIn) -> + encode_unnamed_bit_string(C, <<>>, TagIn); encode_named_bit_string(C, Bits, _NamedBitList, TagIn) when is_bitstring(Bits) -> encode_unnamed_bit_string(C, Bits, TagIn). |