]> git.sur5r.net Git - i3/i3/commitdiff
bugfix: allocate one more zero-byte to definitely get a zero-terminated string
authorMichael Stapelberg <michael@stapelberg.de>
Tue, 1 Jun 2010 16:46:14 +0000 (18:46 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 1 Jun 2010 16:46:14 +0000 (18:46 +0200)
src/ipc.c

index c92f4480d2b29e6d6b76bf8fa4a20f407c1434e4..e757ed2296ca416fe089d174718b3a84c3afee8b 100644 (file)
--- 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);