From: Mathieu Desnoyers Date: Fri, 4 Mar 2011 14:10:40 +0000 (-0500) Subject: Fix off-by-one in open_memstream X-Git-Tag: v1.9.1~428 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=83aa16929ed1e60fabe1bda4824e7c4942ff42ec;p=lttng-ust.git Fix off-by-one in open_memstream size returned by open_memstream does not include the final \0. We have to add 1 to the size of the message sent. Signed-off-by: Mathieu Desnoyers --- diff --git a/libust/tracectl.c b/libust/tracectl.c index b058cb3c..0cff6fda 100644 --- a/libust/tracectl.c +++ b/libust/tracectl.c @@ -957,7 +957,7 @@ static void process_client_cmd(struct ustcomm_header *recv_header, print_markers(fp); fclose(fp); - reply_header->size = size; + reply_header->size = size + 1; /* Include final \0 */ result = ustcomm_send(sock, reply_header, ptr); @@ -983,7 +983,7 @@ static void process_client_cmd(struct ustcomm_header *recv_header, print_trace_events(fp); fclose(fp); - reply_header->size = size; + reply_header->size = size + 1; /* Include final \0 */ result = ustcomm_send(sock, reply_header, ptr);