From: Michael Skree Date: Fri, 2 Feb 2018 03:03:59 +0000 (-0600) Subject: Ensure buffer contents are null-terminated X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=663c4532f0dec4f34d36c425fbc03c37062ec951;p=transmission Ensure buffer contents are null-terminated Data added with `evbuffer_add` isn't null-terminated. This was causing extra characters to appear at the end of the output. Fixes: #174 --- diff --git a/daemon/remote.c b/daemon/remote.c index cfe5810ea..29276189c 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -2108,6 +2108,7 @@ static int flush(char const* rpcurl, tr_variant** benc) break; default: + evbuffer_add(buf, "", 1); fprintf(stderr, "Unexpected response: %s\n", evbuffer_pullup(buf, -1)); status |= EXIT_FAILURE; break;