From 67a6bd5589cf1c86c38deb2af54668d875eb52a7 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 1 Jun 2010 18:46:14 +0200 Subject: [PATCH] bugfix: allocate one more zero-byte to definitely get a zero-terminated string --- src/ipc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ipc.c b/src/ipc.c index c92f4480..e757ed22 100644 --- a/src/ipc.c +++ b/src/ipc.c @@ -112,8 +112,9 @@ void ipc_shutdown() { IPC_HANDLER(command) { /* To get a properly terminated buffer, we copy * message_size bytes out of the buffer */ - char *command = scalloc(message_size); + char *command = scalloc(message_size + 1); strncpy(command, (const char*)message, message_size); + LOG("IPC: received: *%s*\n", command); parse_cmd((const char*)command); tree_render(); free(command); -- 2.39.5