Fix off-by-one in open_memstream
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 4 Mar 2011 14:10:40 +0000 (09:10 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 4 Mar 2011 14:10:40 +0000 (09:10 -0500)
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 <mathieu.desnoyers@efficios.com>
libust/tracectl.c

index b058cb3ce19d0d317790ddbf03103164508d1eb4..0cff6fda9f035e8a009232268530e8e39e206ab4 100644 (file)
@@ -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);
 
This page took 0.024519 seconds and 4 git commands to generate.