aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/c_src/rand.c
diff options
context:
space:
mode:
authorDoug Hogan <[email protected]>2019-01-03 23:13:48 -0800
committerDoug Hogan <[email protected]>2019-01-08 01:11:58 -0800
commit6e2f0721fdf4ead9871bd89a0a395d2bf4f53a48 (patch)
tree0b9eb808baa6a3a33fd5812ffda836be2e74697f /lib/crypto/c_src/rand.c
parentbec8be4ccdf3859861a86eaf5622cf0e04cd2459 (diff)
downloadotp-6e2f0721fdf4ead9871bd89a0a395d2bf4f53a48.tar.gz
otp-6e2f0721fdf4ead9871bd89a0a395d2bf4f53a48.tar.bz2
otp-6e2f0721fdf4ead9871bd89a0a395d2bf4f53a48.zip
Change strong_rand_range_nif() to check for atom_error from bin_from_bn
Diffstat (limited to 'lib/crypto/c_src/rand.c')
-rw-r--r--lib/crypto/c_src/rand.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/crypto/c_src/rand.c b/lib/crypto/c_src/rand.c
index dd1a7a1600..12e0a53493 100644
--- a/lib/crypto/c_src/rand.c
+++ b/lib/crypto/c_src/rand.c
@@ -64,7 +64,8 @@ ERL_NIF_TERM strong_rand_range_nif(ErlNifEnv* env, int argc, const ERL_NIF_TERM
if (!BN_rand_range(bn_rand, bn_range))
goto err;
- ret = bin_from_bn(env, bn_rand);
+ if ((ret = bin_from_bn(env, bn_rand)) == atom_error)
+ goto err;
goto done;
bad_arg: