aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/c_src/crypto.c
diff options
context:
space:
mode:
authorJohn Högberg <[email protected]>2018-07-18 10:23:51 +0200
committerHans Nilsson <[email protected]>2018-08-09 16:41:09 +0200
commit806a409df7cf2b07a39b3876fd36099579df126a (patch)
tree2cabffbb3f0ec80d3fb71152b8dbd0777e34632d /lib/crypto/c_src/crypto.c
parentdb6059a9217767a6e42e93cec05089c0ec977d20 (diff)
downloadotp-806a409df7cf2b07a39b3876fd36099579df126a.tar.gz
otp-806a409df7cf2b07a39b3876fd36099579df126a.tar.bz2
otp-806a409df7cf2b07a39b3876fd36099579df126a.zip
crypto: Fix crash in compute_key(ecdh, ...) on badarg
When term2point was passed a non-binary argument, `my_ecpoint` would be left uninitialized and the cleanup code would free a garbage pointer.
Diffstat (limited to 'lib/crypto/c_src/crypto.c')
-rw-r--r--lib/crypto/c_src/crypto.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c
index 94a207cba6..6e855939f7 100644
--- a/lib/crypto/c_src/crypto.c
+++ b/lib/crypto/c_src/crypto.c
@@ -3757,7 +3757,7 @@ static ERL_NIF_TERM ecdh_compute_key_nif(ErlNifEnv* env, int argc, const ERL_NIF
int i;
EC_GROUP *group;
const BIGNUM *priv_key;
- EC_POINT *my_ecpoint;
+ EC_POINT *my_ecpoint = NULL;
EC_KEY *other_ecdh = NULL;
if (!get_ec_key(env, argv[1], argv[2], atom_undefined, &key))