[erlang-patches] [PATCH] asn1rt_check: Fix transform_to_EXTERNAL1990 for binary input
Harald Welte
laforge@REDACTED
Sat Oct 15 22:43:58 CEST 2011
If ber_bin is used, decoded EXTERNAL types will include a binary
Data_value in the {'EXTERNAL', ...} tuple. When handing such a tuple to
the encoder again, we should properly encode it.
To do so, we treat a binary data part just like a list data part.
---
lib/asn1/src/asn1rt_check.erl | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/lib/asn1/src/asn1rt_check.erl b/lib/asn1/src/asn1rt_check.erl
index 24a2a38..1c5ec89 100644
--- a/lib/asn1/src/asn1rt_check.erl
+++ b/lib/asn1/src/asn1rt_check.erl
@@ -313,7 +313,8 @@ transform_to_EXTERNAL1990([Data_val_desc,Data_value],Acc)
when is_binary(Data_value)->
list_to_tuple(lists:reverse([{'single-ASN1-type',Data_value},
Data_val_desc|Acc]));
-transform_to_EXTERNAL1990([Data_value],Acc) when is_list(Data_value)->
+transform_to_EXTERNAL1990([Data_value],Acc)
+ when is_list(Data_value); is_binary(Data_value) ->
list_to_tuple(lists:reverse([{'octet-aligned',Data_value}|Acc])).
--
1.7.6.3
More information about the erlang-patches
mailing list