X-Git-Url: http://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Ftincctl.c;h=a0a7633df516a964d08d1a0ad42c986e5ebbe142;hb=e16ab7b89948c24a2c47652e8eb1a817a4b1424c;hp=39a11d314a84aa849327c55e36b98ffc5abea106;hpb=4314df644e22778a554ca1760941a2bfae08bce2;p=tinc diff --git a/src/tincctl.c b/src/tincctl.c index 39a11d31..a0a7633d 100644 --- a/src/tincctl.c +++ b/src/tincctl.c @@ -560,6 +560,7 @@ bool sendline(int fd, char *format, ...) { va_start(ap, format); blen = vsnprintf(buffer, sizeof buffer, format, ap); + buffer[sizeof buffer - 1] = 0; va_end(ap); if(blen < 1 || blen >= sizeof buffer) @@ -885,7 +886,7 @@ static int cmd_start(int argc, char *argv[]) { if(!pid) { close(pfd[0]); - char buf[100] = ""; + char buf[100]; snprintf(buf, sizeof buf, "%d", pfd[1]); setenv("TINC_UMBILICAL", buf, true); exit(execvp(c, nargv)); @@ -1391,7 +1392,7 @@ static int cmd_pid(int argc, char *argv[]) { return 1; } - if(!connect_tincd(true) && !pid) + if(!connect_tincd(true) || !pid) return 1; printf("%d\n", pid);