Skip to content

Commit

Permalink
Throw a badargs exception if hints are malformed
Browse files Browse the repository at this point in the history
Previously, hints that were not of the proper types would be silently
discarded.
  • Loading branch information
msantos committed Jul 31, 2010
1 parent 0a2532f commit 8a4cd00
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions c_src/notify.c
Expand Up @@ -151,20 +151,24 @@ nif_notify(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[])
key = array[0];
break;
default:
goto NEXT;
rv = enif_make_badarg(env);
goto ERR;
}
}
else if (enif_is_list(env, head)) {
arity = 0;
key = head;
}
else
goto NEXT;

(void)notify_hints_type(env, notify, arity, key, value);
else {
rv = enif_make_badarg(env);
goto ERR;
}

if (notify_hints_type(env, notify, arity, key, value) < 0) {
rv = enif_make_badarg(env);
goto ERR;
}

NEXT:
hints = tail;
}

Expand Down

0 comments on commit 8a4cd00

Please sign in to comment.