aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-07-20 16:10:35 +0200
committerLukas Larsson <[email protected]>2011-08-01 17:29:45 +0200
commit16e2d02b6a46a3a701cc7581bab114fa5674e9d9 (patch)
tree3ba53d17f9874a4a65dfc68d4e34f310a6ce0854 /lib
parent56a50d49453026491482497a7318f6ee23269bac (diff)
downloadotp-16e2d02b6a46a3a701cc7581bab114fa5674e9d9.tar.gz
otp-16e2d02b6a46a3a701cc7581bab114fa5674e9d9.tar.bz2
otp-16e2d02b6a46a3a701cc7581bab114fa5674e9d9.zip
Fix bug where composite types with more then one element would be encoded in reverse
Diffstat (limited to 'lib')
-rw-r--r--lib/asn1/c_src/asn1_erl_nif.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/asn1/c_src/asn1_erl_nif.c b/lib/asn1/c_src/asn1_erl_nif.c
index 721b3dead5..432148295e 100644
--- a/lib/asn1/c_src/asn1_erl_nif.c
+++ b/lib/asn1/c_src/asn1_erl_nif.c
@@ -1049,7 +1049,10 @@ int ber_encode(ErlNifEnv *env, ERL_NIF_TERM term, mem_chunk_t **curr, unsigned i
ERL_NIF_TERM head, tail;
unsigned int tmp_cnt;
- if (!enif_get_list_cell(env, tv[1], &head, &tail)) {
+ if(!enif_make_reverse_list(env, tv[1], &head))
+ return ASN1_ERROR;
+
+ if (!enif_get_list_cell(env, head, &head, &tail)) {
if (enif_is_empty_list(env, tv[1])) {
*((*curr)->curr) = 0;
(*curr)->curr -= 1;