Fix passing wrong max length to snprintf

When logging very long strings (as netmatch compiler does) we sometime
overrun the string buffer, crashing the stack (as logger buffer is on
the stack, which should not be the case). Notice that neither
-fstack-protector nor valgrind never reported anything :-/

Ideally, snprintf should take ssize_t for max length so that it would
do nothing if the length was negative.

Closes #7