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
This commit is contained in:
Michael Skree 2018-02-01 21:03:59 -06:00
parent 7669c97e12
commit 663c4532f0
1 changed files with 1 additions and 0 deletions

View File

@ -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;