diff options
author | Erlang/OTP <[email protected]> | 2013-02-06 14:47:12 +0100 |
---|---|---|
committer | Erlang/OTP <[email protected]> | 2013-02-06 14:47:12 +0100 |
commit | a30a45e158978a6bc13684505f10d5e3824ee819 (patch) | |
tree | bd07c843b963495026af782b4aad284bed628d9a /lib/asn1/c_src/asn1_erl_nif.c | |
parent | b4b0029f031818a9dce605b73551bca2ed3a01f4 (diff) | |
parent | 0fd671609f7b31a9313d1575434e7273f3f2cd09 (diff) | |
download | otp-a30a45e158978a6bc13684505f10d5e3824ee819.tar.gz otp-a30a45e158978a6bc13684505f10d5e3824ee819.tar.bz2 otp-a30a45e158978a6bc13684505f10d5e3824ee819.zip |
Merge branch 'bjorn/asn1/open-type-error/OTP-10805' into maint-r15
* bjorn/asn1/open-type-error/OTP-10805:
asn1_erl_nif: Correct broken length encoding
asn1_SUITE: Mend broken test_modified_x420/1
Diffstat (limited to 'lib/asn1/c_src/asn1_erl_nif.c')
-rw-r--r-- | lib/asn1/c_src/asn1_erl_nif.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/asn1/c_src/asn1_erl_nif.c b/lib/asn1/c_src/asn1_erl_nif.c index dbff14f9b3..26803a25a4 100644 --- a/lib/asn1/c_src/asn1_erl_nif.c +++ b/lib/asn1/c_src/asn1_erl_nif.c @@ -1134,8 +1134,8 @@ int ber_encode_length(size_t size, mem_chunk_t **curr, unsigned int *count) { (*curr)->curr -= 1; (*count)++; } else { - int chunks = size / 256 + 1; - if (ber_check_memory(curr, chunks + 1)) + int chunks = 0; + if (ber_check_memory(curr, 8)) return ASN1_ERROR; while (size > 0) @@ -1144,6 +1144,7 @@ int ber_encode_length(size_t size, mem_chunk_t **curr, unsigned int *count) { size >>= 8; (*curr)->curr -= 1; (*count)++; + chunks++; } *(*curr)->curr = chunks | 0x80; |