summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpukkamustard <pukkamustard@posteo.net>2020-11-07 08:48:21 +0100
committerpukkamustard <pukkamustard@posteo.net>2020-11-07 08:48:21 +0100
commit338a276c62cccd1b77b23ed40a1c36f223b0e4b3 (patch)
treed3a2248d7c5104bf032dc55bdf830eb8e50c6a98
parentefd8aa3927691225dfb82785f86570e44f5d88a1 (diff)
* c_src/monocypher_nif.c(crypto_blake2b_general): check size of key
-rw-r--r--c_src/monocypher_nif.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/c_src/monocypher_nif.c b/c_src/monocypher_nif.c
index c874889..1dd7816 100644
--- a/c_src/monocypher_nif.c
+++ b/c_src/monocypher_nif.c
@@ -44,6 +44,12 @@ static ERL_NIF_TERM crypto_blake2b_general_nif(ErlNifEnv* env, int argc, const E
return enif_make_badarg(env);
}
+ // key size must be betweeen 0 and 64
+ if(key.size < 0 || key.size > 64) {
+ return enif_make_badarg(env);
+ }
+
+
ErlNifBinary message;
if(!enif_inspect_binary(env, argv[2], &message)) {
return enif_make_badarg(env);