This uses dynamic allocation for the log message, although it needs a couple of stabs at it because of the varargs (vasprintf(), then asprintf()).
I wouldn't say it's particularly pretty, but it fixes #75 and eliminates the fixed buffer and trusted lvl and ident inputs. The err string is still trusted, but it's only supplied by strerror, so should be OK.
I've fuzzed it by taking 8 kB+ input from /dev/urandom, and valgrind (at least on Linux) seems happy.
As discussed in #75.
This uses dynamic allocation for the log message, although it needs a couple of stabs at it because of the varargs (vasprintf(), then asprintf()).
I wouldn't say it's particularly pretty, but it fixes #75 and eliminates the fixed buffer and trusted lvl and ident inputs. The err string is still trusted, but it's only supplied by strerror, so should be OK.
I've fuzzed it by taking 8 kB+ input from /dev/urandom, and valgrind (at least on Linux) seems happy.