Force nul-termination of strings after vsnprintf().
[tinc] / src / dropin.c
index eb17aca..cd5563a 100644 (file)
@@ -140,6 +140,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)