[PATCH] chunkd: fix debug output when the request key is not null-terminated

Akinobu Mita <[email protected]>
Newsgroups org.kernel.vger.hail-devel
Message-ID <[email protected]>
If the request key is not null-terminated and the debug output is enabled,
it prints invalid and unsafe value. Add a precision to fix it.

Signed-off-by: Akinobu Mita <[email protected]>
---
 server/server.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/server/server.c b/server/server.c
index 4d9a09e..5b34725 100644
--- a/server/server.c
+++ b/server/server.c
@@ -1053,9 +1053,10 @@ static bool cli_evt_exec_req(struct client *cli, unsigned int events)
 		goto err_out;
 
 	if (debugging)
-		applog(LOG_DEBUG, "REQ(op %s, key %s (%u), user %s) "
+		applog(LOG_DEBUG, "REQ(op %s, key %.*s (%u), user %s) "
 		       "seq %x len %lld login %s",
 		       op2str(req->op),
+		       cli->key_len,
 		       cli->key,
 		       cli->key_len,
 		       cli->user,
-- 
1.6.5.5
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.