]> granicus.if.org Git - transmission/commitdiff
Ensure buffer contents are null-terminated
authorMichael Skree <michael.skree@gmail.com>
Fri, 2 Feb 2018 03:03:59 +0000 (21:03 -0600)
committerMichael Skree <michael.skree@gmail.com>
Sat, 3 Feb 2018 19:45:44 +0000 (13:45 -0600)
Data added with `evbuffer_add` isn't null-terminated. This was causing
extra characters to appear at the end of the output.

Fixes: #174
daemon/remote.c

index cfe5810ea44a6a9f727be9aec879e1209518d24f..29276189c7fc186005d5e5015414108d95152d02 100644 (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;