From: Michael Stapelberg Date: Tue, 1 Jun 2010 16:46:14 +0000 (+0200) Subject: bugfix: allocate one more zero-byte to definitely get a zero-terminated string X-Git-Tag: tree-pr1~204 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=67a6bd5589cf1c86c38deb2af54668d875eb52a7;p=i3%2Fi3 bugfix: allocate one more zero-byte to definitely get a zero-terminated string --- 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);