aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/c_src/asn1_erl_nif.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-02-07 12:20:09 +0100
committerBjörn Gustavsson <[email protected]>2013-02-07 12:23:36 +0100
commitd45c6b727da8db7664d2cc08a16ef8ca68fe46df (patch)
tree9c54e0860b805d379c4b770428b8a6ac2a603d9e /lib/asn1/c_src/asn1_erl_nif.c
parent258c6a4b0e393d6112c738ae0c4d4b7f699d5e47 (diff)
parentc310adbff67aa89f1ad3bff7c0a03c3506fe85ee (diff)
downloadotp-d45c6b727da8db7664d2cc08a16ef8ca68fe46df.tar.gz
otp-d45c6b727da8db7664d2cc08a16ef8ca68fe46df.tar.bz2
otp-d45c6b727da8db7664d2cc08a16ef8ca68fe46df.zip
Merge branch 'maint-r15' into maint
* maint-r15: Prepare release Don't run testX420/1 on old slow Sparc systems testX420: Pass Options to the ASN.1 compiler asn1_erl_nif: Correct broken length encoding asn1_SUITE: Mend broken test_modified_x420/1 Fix a bug for multiple extension addition groups
Diffstat (limited to 'lib/asn1/c_src/asn1_erl_nif.c')
-rw-r--r--lib/asn1/c_src/asn1_erl_nif.c5
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;