Browse Source

Bugfix: RPC: Restore null termination on responses

Luke Dashjr 12 years ago
parent
commit
7715d70f40
2 changed files with 4 additions and 2 deletions
  1. 3 1
      api.c
  2. 1 1
      libblkmaker

+ 3 - 1
api.c

@@ -3296,7 +3296,9 @@ static void send_result(struct io_data *io_data, SOCKETTYPE c, bool isjson)
 	if (isjson)
 	if (isjson)
 		io_add(io_data, JSON_END);
 		io_add(io_data, JSON_END);
 	
 	
-	bytes_nullterminate(&io_data->data);
+	// Null-terminate reply, including sending the \0 on the socket
+	bytes_append(&io_data->data, "", 1);
+	
 	applog(LOG_DEBUG, "API: send reply: (%ld) '%.10s%s'",
 	applog(LOG_DEBUG, "API: send reply: (%ld) '%.10s%s'",
 	       (long)bytes_len(&io_data->data),
 	       (long)bytes_len(&io_data->data),
 	       bytes_buf(&io_data->data),
 	       bytes_buf(&io_data->data),

+ 1 - 1
libblkmaker

@@ -1 +1 @@
-Subproject commit 8f4bb3ee9f43405203fef6f64ca938dc7933a060
+Subproject commit bca8f6f5e56c547e9bbc808fb644152e44f3344d