filter: Handle bad filter numbers gracefully.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 13 Jun 2017 20:33:26 +0000 (22:33 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 14 Jun 2017 17:54:01 +0000 (19:54 +0200)
commitc6dc6e36a70e580892d8bc190cd41376f449bdfd
tree808ce17025961348ca083cb5cf3c5889c6e0ac00
parent73eea97d6501c90f37d44e9f2a31bb6defe2e338
filter: Handle bad filter numbers gracefully.

This modifies filter_get() to return NULL if an invalid filter number
is given, rather than aborting the process. This way applications
can loop over all filters without having to include filter_cmd.lsg.h.

filter_name(), which also receives a filter number, has no such
sanity check and could possibly access uninitialized memory if an
invalid argument was passed. This commit adds the check and makes the
function return NULL in this case, just like filter_get(). Moreover,
the function lacked documentation, so let's add it now.
filter_common.c