aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/c_src
diff options
context:
space:
mode:
Diffstat (limited to 'lib/asn1/c_src')
-rw-r--r--lib/asn1/c_src/asn1_erl_nif.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/asn1/c_src/asn1_erl_nif.c b/lib/asn1/c_src/asn1_erl_nif.c
index 7ce461ad5c..a9bf98c44a 100644
--- a/lib/asn1/c_src/asn1_erl_nif.c
+++ b/lib/asn1/c_src/asn1_erl_nif.c
@@ -1015,6 +1015,9 @@ static ERL_NIF_TERM encode_per_complete(ErlNifEnv* env, int argc,
if (!enif_alloc_binary(in_binary.size, &out_binary))
return enif_make_atom(env, "alloc_binary_failed");
+ if (in_binary.size == 0)
+ return enif_make_binary(env, &out_binary);
+
if ((complete_len = complete(&out_binary, in_binary.data, in_binary.size))
<= ASN1_ERROR) {
enif_release_binary(&out_binary);