Force nul-termination of strings after vsnprintf().
[tinc] / src / dropin.c
index fe3b7ef..c7b558a 100644 (file)
@@ -106,6 +106,7 @@ int vasprintf(char **buf, const char *fmt, va_list ap) {
 
        va_copy(aq, ap);
        status = vsnprintf(*buf, len, fmt, aq);
+       buf[len - 1] = 0;
        va_end(aq);
 
        if(status >= 0)