Permalink
Browse files

Initialize the buf instead of zeroing

  • Loading branch information...
msantos committed Mar 14, 2012
1 parent 21a74d6 commit 153651970e3f2caa154c8da49214457500bbd3a8
Showing with 2 additions and 5 deletions.
  1. +2 −5 c_src/crypt.c
View
@@ -43,14 +43,11 @@ load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM load_info)
static ERL_NIF_TERM
nif_crypt(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
{
- char key[MAXBUFLEN];
- char salt[MAXBUFLEN];
+ char key[MAXBUFLEN] = {0};
+ char salt[MAXBUFLEN] = {0};
char *result = NULL;
- (void)memset(&key, '\0', sizeof(key));
- (void)memset(&salt, '\0', sizeof(salt));
-
if (enif_get_string(env, argv[KEY], key, sizeof(key), ERL_NIF_LATIN1) < 1)
return enif_make_badarg(env);

0 comments on commit 1536519

Please sign in to comment.