logging: make sure the output is null-terminated

If we reach the buffer size or snprintf fails, we want to make sure
that the output is null-terminated.
1 file changed