aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/c_src/asn1_erl_nif.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-01-10 14:14:19 +0100
committerBjörn Gustavsson <[email protected]>2013-01-22 19:20:11 +0100
commiteefed16b34af8497c8eb28c74367a1bd44b0d9bd (patch)
tree84c0a6e7c81850e7f30a1d0670a4f337874ff250 /lib/asn1/c_src/asn1_erl_nif.c
parent70caf52f1a7e09569c776bb1f99b0bf4737c63c2 (diff)
downloadotp-eefed16b34af8497c8eb28c74367a1bd44b0d9bd.tar.gz
otp-eefed16b34af8497c8eb28c74367a1bd44b0d9bd.tar.bz2
otp-eefed16b34af8497c8eb28c74367a1bd44b0d9bd.zip
BER: Correct bug in 'undec_rest'
enif_make_new_binary() cannot return NULL, so while at it, remove the check for return value of enif_make_new_binary() being NULL.
Diffstat (limited to 'lib/asn1/c_src/asn1_erl_nif.c')
-rw-r--r--lib/asn1/c_src/asn1_erl_nif.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/asn1/c_src/asn1_erl_nif.c b/lib/asn1/c_src/asn1_erl_nif.c
index 73323534d2..7f1870d5b0 100644
--- a/lib/asn1/c_src/asn1_erl_nif.c
+++ b/lib/asn1/c_src/asn1_erl_nif.c
@@ -850,11 +850,8 @@ int ber_decode_begin(ErlNifEnv* env, ERL_NIF_TERM *term, unsigned char *in_buf,
};
// The remaining binary after one ASN1 segment has been decoded
- if ((rest_data = enif_make_new_binary(env, in_buf_len - ib_index, &rest))
- == NULL) {
- *term = enif_make_atom(env, "could_not_alloc_binary");
- return ASN1_ERROR;
- }
+ rest_data = enif_make_new_binary(env, in_buf_len - ib_index, &rest);
+ memcpy(rest_data, in_buf+ib_index, in_buf_len - ib_index);
*term = enif_make_tuple2(env, decoded_term, rest);
return ASN1_OK;