From: Guus Sliepen Date: Tue, 31 Jan 2017 11:03:27 +0000 (+0100) Subject: Fix potential segfault in the replacement vasprintf() function. X-Git-Tag: release-1.1pre15~48 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=88d158e15b9e16b4227b374d8bb4640010670cef;p=tinc Fix potential segfault in the replacement vasprintf() function. --- diff --git a/src/dropin.c b/src/dropin.c index c7b558a4..a4f7a65d 100644 --- a/src/dropin.c +++ b/src/dropin.c @@ -106,14 +106,13 @@ 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) *buf = xrealloc(*buf, status + 1); if(status > len - 1) { - len = status; + len = status + 1; va_copy(aq, ap); status = vsnprintf(*buf, len, fmt, aq); va_end(aq);