Simplify the existing elaborate string checks in code

For that it introduces strlcpy() and strlcat(), which ensure
that all output strings are null-terminated.
run autoreconf